Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. SmtpClient 2.0 Framework

SmtpClient 2.0 Framework

Scheduled Pinned Locked Moved .NET (Core and Framework)
comsysadminquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    James Simpson
    wrote on last edited by
    #1

    The SmtpClient does not seem to call the QUIT Command to close the connection to an SMTP server, is this usual behaviour? It appears to keep the connection open between each mail that is sent. I would assume that at bare minimum it should call QUIT when the application that is using the SmtpClient object is shut down. Regards, J James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
    Mitch Hedberg

    D 1 Reply Last reply
    0
    • J James Simpson

      The SmtpClient does not seem to call the QUIT Command to close the connection to an SMTP server, is this usual behaviour? It appears to keep the connection open between each mail that is sent. I would assume that at bare minimum it should call QUIT when the application that is using the SmtpClient object is shut down. Regards, J James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
      Mitch Hedberg

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      James Simpson wrote:

      I would assume

      Didn't your mother tell you impolite to swear like that? :-D The SmtpClient class is a wrapper for the CDONTS COM Component, and its NewMail class. It is NOT a full .NET implementation of a SMTP client. It is poissible that the CDONTS class doesn't send a QUIT command. You'll have to setup a packet sniffer between your machine and the network to figure this out. I haven't been able to find any documentation on whether it actually does this or not. If you have to guarantee a QUIT command being sent, you'll have to implement your own SMTP client in your code. Just Google for "C# SMTP Client" and you'll find a bunch of examples. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome -- modified at 13:19 Wednesday 11th January, 2006

      J 1 Reply Last reply
      0
      • D Dave Kreskowiak

        James Simpson wrote:

        I would assume

        Didn't your mother tell you impolite to swear like that? :-D The SmtpClient class is a wrapper for the CDONTS COM Component, and its NewMail class. It is NOT a full .NET implementation of a SMTP client. It is poissible that the CDONTS class doesn't send a QUIT command. You'll have to setup a packet sniffer between your machine and the network to figure this out. I haven't been able to find any documentation on whether it actually does this or not. If you have to guarantee a QUIT command being sent, you'll have to implement your own SMTP client in your code. Just Google for "C# SMTP Client" and you'll find a bunch of examples. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome -- modified at 13:19 Wednesday 11th January, 2006

        J Offline
        J Offline
        James Simpson
        wrote on last edited by
        #3

        Dave Kreskowiak wrote:

        The SmtpClient class is a wrapper for the CDONTS COM Component, and its NewMail class. It is NOT a full .NET implementation of a SMTP client.

        I think you are refering to the 1.0/1.1 version of the Web.Mail classes, the new one (2.0) appears to be a ground up implementation of an Smtp Client which would work standalone

        Dave Kreskowiak wrote:

        If you have to guarantee a QUIT command being sent, you'll have to implement your own SMTP client in your code. Just Google for "C# SMTP Client" and you'll find a bunch of examples.

        Its not that I need the QUIT Command sending, it is workable. If you created a forms app with a button to send a simple mail through the local SMTP server (lets assume IIS), run the application, click the button to send the mail, then restart the IIS SMTP Service, and click send again the application will fall over because the connection was closed, even though the connection has been reopened. We have an inhouse smtp service which causes exactly the same problem because it has a timeout on it, if this is normal behaviour then someone using the SmtpClient would need to wrap it in a Try Catch to resend under these conditions. I would have hoped that the SmtpClient would clean itself up and attempt to reconnect to the server itself. Or send a QUIT message after the message has been sent to the server. Thanks, James James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
        Mitch Hedberg

        D 1 Reply Last reply
        0
        • J James Simpson

          Dave Kreskowiak wrote:

          The SmtpClient class is a wrapper for the CDONTS COM Component, and its NewMail class. It is NOT a full .NET implementation of a SMTP client.

          I think you are refering to the 1.0/1.1 version of the Web.Mail classes, the new one (2.0) appears to be a ground up implementation of an Smtp Client which would work standalone

          Dave Kreskowiak wrote:

          If you have to guarantee a QUIT command being sent, you'll have to implement your own SMTP client in your code. Just Google for "C# SMTP Client" and you'll find a bunch of examples.

          Its not that I need the QUIT Command sending, it is workable. If you created a forms app with a button to send a simple mail through the local SMTP server (lets assume IIS), run the application, click the button to send the mail, then restart the IIS SMTP Service, and click send again the application will fall over because the connection was closed, even though the connection has been reopened. We have an inhouse smtp service which causes exactly the same problem because it has a timeout on it, if this is normal behaviour then someone using the SmtpClient would need to wrap it in a Try Catch to resend under these conditions. I would have hoped that the SmtpClient would clean itself up and attempt to reconnect to the server itself. Or send a QUIT message after the message has been sent to the server. Thanks, James James Simpson Web Developer imebgo@hotmail.com P S - This is what part of the alphabet would look like if Q and R were eliminated
          Mitch Hedberg

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Nope. 2.0 wraps up the same CDONTS object. It just uses more code to do it. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups