Has anybody had issues with this? If so, how do you get around it? We are getting sporadic timeout issues and this is getting blamed.
The same issue is reported here as well:
http://www.vbforums.com/showthread.php?p=3609268
I don't know if there's an easier way to work around this specific problem, but one option would be to download the source for Mono's SmtpClient and use that (modifying if necessary). Their version definitely does send a QUIT command.
One project that I work on required us to send large numbers of emails. .NET's implementation was too inefficient, not providing any way to send multiple distinct emails in the same SMTP session. We fell back on using Mono's implementation and modifying it to allow us to manually control when the QUIT command was sent and the connection closed. There were a total of 25 relevant Mono classes that we had to merge into our project for this (mostly copy+paste and edit namespace).
It seems a little extreme, but if there's no way to work around the issue, it may be your best 3rd-party alternative: it's free, it's not a great deal of work and its API is almost identical to the native SmtpClient's.
Is your application running on a machine with an IIS? If so, you could take advantage of the built-in SMTP Service by setting the delivery method of your SMTP client like this:
var client = new SmtpClient
{
DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis
};
I am using this in a few applications, and it's very reliable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With