Skip to main content

Configure Office 365 SMTP with WordPress & Contact Form 7

By October 16, 2019April 13th, 2023Blog
Configure O365 SMTP For Wordpress

By default, WordPress uses PHP mail to send website form submissions.

This function usually works fine if your website server hasn’t been blacklisted for spam. If you are on a shared server that has been blacklisted for spam, emails may not get through. This means you will need to use a dedicated email account for the site + SMTP to ensure form submissions, WooCommerce order emails etc, are sent and received.

Using O365 for sending form submissions

When someone completes a form on your website, the website attempts to send the submission via an email. If your domain is using O365, the email will be flagged as spam by Office 365 because it hasn’t come from an authenticated email account or approved server machine for the domain.

How do we fix it?

As your IT person to help you with the following:

  1. Create an email account for the website to use. Example:
  2. Add an SPF record to the O365 DNS server to authenticate email from the site server IP.
  3. Add the web hosting server IP to the whitelist.
  4. Use SMTP settings in the website.

SMTP Settings

I prefer to use PostSMTP plugin to enable my WordPress site to send via SMTP.

SMTP stands for Simple Mail Transfer Protocol and authenticates emails sent from the website.

Use the settings below to set up configure Office 365 SMTP with the PostSMTP plugin.


Mailer Type

Outgoing Mail Server Hostname

Outgoing Mail Server Port

Envelope-From Email Address
Enter the email account to be used.



Enter the email account to be used.


Save Changes.

Contact Form 7

The final piece in the puzzle is to check the form in your website. In this instance I am using Contact Form 7.

  1. Click Contact / Contact Form
  2. Click the Mail tab.
  3. In the from field ensure you remove the default email account.
    Change this <> to <> . This is the O365 email account you created for sole use by the website.

Save and test. Good luck!