Sending emails from Azure hosting

Topics: General
Mar 9, 2011 at 11:18 AM

Hi,

I have been trying to get my Orchard installation on Azure to send emails with no luck so far. Can anyone confirm that they have Orchard successfully sending emails when hosted on Azure??

I have just been using the user self registration forms to generate the test emails.  I am assuming that that would normally work.

 

Cheers

Sam

Coordinator
Mar 9, 2011 at 9:38 PM

It seems that you have to enable full trust to send email from Azure.

Please read this article in order to configure your instance in full trust:

http://blogs.msdn.com/b/windowsazure/archive/2009/03/18/hosting-roles-under-net-full-trust.aspx

 

Mar 10, 2011 at 1:42 AM

Thanks for the quick reply Sebastien.

It seems that the answer may be a bit more complicated than that.  In the end I was able to get email sending to work after I subscribed to a 3rd party SMTP service.

As I understand it you can send smtp emails, providing that the outbound port is port 25.  In my case I was trying to use gmail as a host which needs to use either the TLS or SSL ports (i.e. not 25).  Once I had a 3rd party service that accepted emails on port 25, it seems happy now.

Hopfully this info will help others having the same problem.

 

Cheers

Sam

Mar 14, 2011 at 11:24 PM

Sam,

Gmail (somewhat surprisingly) supports SSL over port 25. I have personally tested and verified on Orchard at Azure moments ago. Via http://forums.crystaltech.com/index.php/topic,33004.msg185776.html#msg185776

Travis

Jan 7, 2015 at 6:19 PM
Hi,

There are still too many different suggestions on the subject so i thought i should write what I've found useful. Here's what i did to get it to work:

My SMTP settings are:

Sender address: myname@gmail.com Hostname: smtp@gmail.com Port: 587 (25 will also do)
SSL Communications: Checked
Credentials: My Gmail address and my password

These settings should work on your local environment just fine. But on the cloud you may need to do the following:

As your Azure VM may be at some arbitrary location, Gmail marks the login attempts as suspicious and blocks them. If this is the case, you should see a mail informing you about this suspicious activity in your inbox. Just follow the instructions there and mark the login as trusted. It will remain that way until somehow your IP on the cloud changes (e.g. deleting your deployment slot). VM relocation shouldn't be an issue since the IP still remains the same. You may have to do this separately for your staging and production slots.

Lastly, i followed Sebastien's suggestion and enabled full trust for my web role as shown here:
http://blogs.msdn.com/b/windowsazure/archive/2009/03/18/hosting-roles-under-net-full-trust.aspx

I hope this helps others having this problem.

Cheers
Coordinator
Jan 7, 2015 at 6:44 PM
Personally I use either SendGrid or Mandrill to send emails from Azure. They are free for a very good amount of emails sent per day, and above that it's still very cheap. Very fast and reliable too. You should try it, Sendgrid is also available from the Azure portal, so you don't even need to create a new account, just copy-paste the creds it gives you in the Orchard settings.