Arrow icon
Back to Insights

Send emails from Windows Azure with SendGrid

April 24, 2011
Arra Derderian

After moving our website to Windows Azure we had one problem. Well we had a couple, but all of them were resolved pretty simply. The one that lingered was that our Contact Form stopped working. This is because there is no email server used for relay in Azure. Microsoft does this so people cannot send out millions of spam emails from Azure. Needless to say this made it hard to get a simple contact form working. We did not want to expose our hosting server email server to the outside ourselves because we could not verify our Azure server IP would be the same all the time. After searching for some solutions out there the best option seemed to be to use a third party email service like Amazon, SendGrid, or Postmark. Being a small business we knew we didn't want to pay anything to just have our contact form send one or two emails a month. The lowest plan I could find was $9.95/month from SendGrid. This was still too much. I then scrolled to the bottom of the pricing page and found a FREE option! Just scroll to the bottom of the page:

Once I signed up for the free plan it took a few hours for my account to be provisioned. Once that was done I was able to integrate my existing C# code which looked very much like this, C# SMTP example. You can also use the REST protocol but this is much cleaner in my mind. I tried testing the code from my dev environment but I kept getting an error saying the server could not be reached. I then thought maybe I can only access the email server from behind the URL I registered. So I pushed the code to Azure and gave it a whirl. It worked! Voila an email solution that lets you send 200 emails a day for free, and it works from Azure. Hopefully our contact form gets some activity in the coming months!

About the Author:

Arra Derderian serves as the President and as a Lead Technical Architect for Cloud Construct. As a founder at Cloud Construct, Arra is involved in all levels of the business from new project engagements, project planning, and development.

He also serves as the founder of the Boston Orchard CMS User Group and is a member of the Windows Azure Insiders group.

Arra graduated from Northeastern University School with a Bachelor of Science degree in Computer Science.

Author Photo
Arra Derderian
Founder & Chairman
Arrow icon
Back to Insights

Let's talk about your project

Drop us a note
Arrow
Or call us at:  
1.617.903.7604

Let's talk about
your project

Drop us a note
Arrow
Or call us at:
1.617.903.7604

Let's talk about your project

Drop us a note
Arrow
Or call us at:  
1.617.903.7604