Good day.

Tell me, please, on this issue: Commands from my client come to my SMTP server in this order:

Ehlo

MAIL FROM

RCPT TO

Data

But then - no commands, until the timeout. This is what confused me - if the EHLO command is used , then the BDAT command should be used instead of DATA . Right?

Most interesting: I answer the DATA command:

"354 Start mail input; end with. \ R \ n"

then I read the text of the letter, then I write to the client

"250 OK \ r \ n"

Now, in theory, the client should send the command "QUIT", but it did not follow. I'm at a loss, no more ideas left. Can anyone come across this? Judging by the literature in the network, I'm doing everything right, but obviously not everything ..

UPD

I check service work

var client = new SmtpClient("Leonardo-PC", 25); var m = new MailMessage("localm@bank.lan", "+38065741545@Leonardo-PC"); m.Body = "Hello"; client.Send(m); Console.WriteLine(">> " + i + " (1)"); 

The code hangs on client.Send(m); then the connection is broken by timeout

Maybe I'm doing something wrong?

    1 answer 1

    This is what confused me - if the EHLO command is used, then the BDAT command should be used instead of DATA. Right?

    Not true The client can use BDAT , but only if the server sent 250 CHUNKING client in response to the EHLO , indicating that the server supports the extension for chunked transfer. Although it may not be used (even if the server supports this extension).

    Now, in theory, the client should send the command "QUIT", but it was not followed

    Should not. The client can maintain a connection with the server as long as possible - to be able to send subsequent messages In particular, the standard SmtpClient sends QUIT only when calling Dispose() .

    • I updated the question - I wrote exactly how I check the service, but even there is something wrong - the code hangs on the email line until the timeout - Leonard Bertone