Azure DevOps, Scrum, & .NET Software Leadership and Consulting Services

Free course! Predicting the Future, Estimating, and Running Your Projects with Flow Metrics

Send emails from WordPress hosted on Microsoft Azure Web Sites with/without Office 365


I moved my WordPress-powered site & blog to Microsoft Azure from another web hoster last week.  The move was pretty easy and the site is running MUCH faster on Azure but there were still a few little details that needed to get worked out.  The big one was figuring out how to get notification emails from WordPress.  The trick was finding an SMTP server that I could use.  Two facts: 1) Windows Azure doesn’t provide you with an SMTP server and 2) I host my email on Office 365.

Last week, I was searching around on the internet(s) for answers and kept coming back to the same page on how to configure Office 365 SMTP relay.  I wanted to do the SMTP Relay option that authenticated using IP addresses rather than the account for my mailbox because I’m not a complete fool and I didn’t want to put my email mailbox’s username and password in cleartext in WordPress.  I tried and tried and tried and tried and I couldn’t get it to work.

This morning, I ran the same internet search and came back to the same page.  Same dead end…but WAIT!  There’s updated information on this page now!  There’s a “Tip” that says “This method cannot be used with Azure or addresses on a Policy Block List.”

Answer #1: You can’t use your Office 365 account to send emails from WordPress hosted in Windows Azure without a password.  Not the answer I wanted but at least it explains why it wasn’t working.

Answer #2: Use SendGrid to Send Emails from Azure.

Next, the gods of the internet(s) saw fit to show me this page from the Azure documentation titled “How to Send Email Using SendGrid with Azure”.  (Well, that sounds promising.)  Here are the quick steps to configure it:

1. Log into your Microsoft Azure Dashboard — http://manage.windowsazure.com

2. Click the New button in the lower left

3. Click Store

4. Choose SendGrid Email Delivery

5. Follow the rest of the steps to set up your SendGrid account.

6. When your SendGrid account has been provisioned, you’ll see a menu at the bottom of the screen with a button that says Connection Info.  When you click this button, it will display the SMTP Server address, your username, and your password.

Answer #3: Use WP Mail SMTP to configure your WordPress email settings and to send test emails.

Now that you have an SMTP server to use, you need to plug those values into WordPress.  I found the WP Mail SMTP WordPress Plug-In to be extremely helpful for this.   After you install WP Mail SMTP, you’ll get a new option in your WordPress Settings menu named “Email”.

Plug your SendGrid account settings into the Email configuration form from WP Mail SMTP and send a test mail.  This time it should work.

I hope this helps!

-Ben

 

 

 

SUBSCRIBE TO THE BLOG


7 responses to “Send emails from WordPress hosted on Microsoft Azure Web Sites with/without Office 365”

  1. Manesh Samtani Avatar

    You are a freakin’ life-saver!!
    I was beating my head against this all day until I found your page.
    Thank you very very very very much Ben!

  2. Jay Et Kay Avatar
    Jay Et Kay

    Seriously? You just opened over 10 0000 holes for crackers to compromize your systems!
    So bad and so WRONG information!

    1. Ben Day Avatar

      Hi Jay —

      Thanks for the comment. What would you do instead? Where did we go wrong?

      -Ben

  3. Marilize Avatar
    Marilize

    Thanks! This helped me.

  4. suhani Avatar
    suhani

    Hi,
    Your article helped me to establish a test connection. I got test email. Thank you!

    But I want to know that, is there anything need to do after setting up SMTP in Dashbord panel. I tried to send actual email from Contact us form of the website but it didn’t work for me. I tried by adding 2-3 different email address like outlook, gmail,.. but no one worked for me. M i missing anything while sending actual email from contact us form ?

  5. Abdul Saboor Avatar
    Abdul Saboor

    very helpful , Thank you

  6. Aaron Affleck Avatar
    Aaron Affleck

    Thanks, this helped immensely.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.