Hi,
It only sends a single MailMessage from a connection. In fact, it doesn't even properly close the connection. It sends the mail, but then it doesn't tell the mail server it wants to quit. So, it just leaves it hanging open, until the underlying pooled stream decides to close the socket.
Here is the internal code from Reflector:
...
this.GetConnection();
fileMailWriter = this.transport.SendMail((message.Sender != null) ? message.Sender : message.From, recipients, message.BuildDeliveryStatusNotificationString(), out exception);
}
catch (Exception exception2)
{
if (Logging.On)
{
Logging.Exception(Logging.Web, this, "Send", exception2);
}
if ((exception2 is SmtpFailedRecipientException) && !((SmtpFailedRecipientException) exception2).fatal)
{
throw;
}
this.Abort();
if (this.timedOut)
{
throw new SmtpException(SR.GetString("net_timeout"));
}
if (((exception2 is SecurityException) || (exception2 is AuthenticationException)) || (exception2 is SmtpException))
{
throw;
}
throw new SmtpException(SR.GetString("SmtpSendMailFailure"), exception2);
}
btw, here is more info about the SmtpClient not issuing the QUIT command.
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=146711&wa=wsignin1.0
The work-around is to set SmtpClient.ServicePoint.MaxTimeout to 1. This will close the socket faster, however, this doesn't actually issue the QUIT command.
Cheers!
Dave