Email Listener - SendAsync

Topics: Logging Application Block
Jul 4, 2010 at 4:36 PM

I was looking at the Email Logging option in the 5.0 Enterprise Library. The EmailMessage.cs class uses the synchronous Send method of the SMTP Client object:

public virtual void SendMessage(MailMessage message)
	SmtpClient smtpClient = new SmtpClient(configurationData.SmtpServer, configurationData.SmtpPort);
	smtpClient.EnableSsl = configurationData.UseSSL;

Any reason why we are not using SendAsync? Are there any concerns that the calling methods will be blocked by this synchronous call?

SendAsync by the way behaves weird and I had to write my own Thread handling previously on top of the Send method. I wonder if this is why this is not used currently?

Jul 5, 2010 at 12:52 AM

This is a design question, we'll forward this to the entlib team.

Jul 7, 2010 at 7:04 PM

That listener was written before I started on the project, but my guess would be because at the time it was written there was no "SendAsync" method. That listener hasn't been touched much other than the addition in V5 of authenticated SMTP.