Sending Email from Azure

On-premise applications often have a need to send email. For instance an order entry system might have to send an email request to an external vendor to drop-ship all or part of an order.  An event registration system might have to send email confirmations and reminders of an upcoming event. 

In an on-premise application ASP.NET provides a component: Collaboration Data Objects (CDO) that can be used to send email directly from an application.  Windows Azure does not provide a built in capability for sending email.



There are however a couple of solutions for this that you can use until Azure does support this capability:

1. You can leverage an on-premises SMTP server.  You will need to have the SMTP server accessible by the Azure application.  Normally, that requires you to give network engineers the IP address of the application so that they can allow connectivity.  This IP address may change when you delete and re-deploy your application (such as when you add or remove a role, add or remove a configuration setting, change certificate, etc.), but it is one solution.

2. You can also use the Office365 (Exchange Online) service.  However, you can only send messages in the names of the authenticated sender (i.e. you can’t use some arbitrary email address such as as sender).  You also need to set enablessl to true as well.   For more information on how to set this method up see this blog post.

My thanks to Harry Chen of Microsoft for some of the material in this article.

Bill Zack