locked
SMTPClient - QUIT command RRS feed

  • Question

  • Hello,

     

     Which method in the SMTPClient class will send the QUIT command to the SMTP Server?

     

    The Send() method does not seem to send the QUIT command after sending the <CRLF>. message(to signal end of the email body).

     

    I'm have a simple SMTP server implementation which uses TCPListener to read from and write data to port 25.

    But StreamReader's ReadLine() method is waiting endlessly for QUIT after reading <CRLF>. and sending a usual "250 blah blah" message.

     

    Please let me know if I'm missing anything.

     

    Thanks!

    Wednesday, May 23, 2007 3:10 AM

All replies

  • I think your question is answered in this previous posting on this forum.

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=382014&SiteID=1

     

    Wednesday, May 23, 2007 10:57 PM
    Moderator
  • Hi Jon,

     

    I tried SmtpClient.ServicePoint.MaxIdleTime = 0 but still the server does not receive the QUIT command from the client.

     

    The code I use on the client side is,

     

    MailMessage msg = new MailMessage();

    msg.From = new MailAddress("from@test.com");

    msg.To.Add(new MailAddress("to@test.com"));

    msg.Subject = "Test Email";

    msg.Body = "This is a test email";

    SmtpClient smtp = new SmtpClient("host", 25);

    smtp.ServicePoint.MaxIdleTime = 0;

    smtp.Send(msg);


     

    Is it because Send() is blocking? Please let me know. Thanks!

    Thursday, May 24, 2007 12:53 AM
  • Does the above code result in the connection being closed after the send completes?  Can you get a network sniff or a trace log?

     

     

    Thursday, May 24, 2007 4:36 PM
    Moderator