Configure your WordPress site to send E-mail via Exchange Online (Office 365) provide user credentials | Part 4#6 5/5 (1)

10 min read

In the current article, we review how to configure a WordPress site, to address Office 365 mail by using the recommended configuration.

In a scenario in which our WordPress website serves as a “mail client” that addresses mail server and asks him to be “his mail server,” the best practice is to configure the mail client (WordPress site in our exhale) to provide user credentials to the mail server.

The best practice is that the mail client, will proof his identity

The configuration in which the mail client provides user credentials have the following advantages:

  1. An e-mail message that is sent from the WordPress site to – organization recipients, will not be “stamped” as spam mail by the Exchange Online server because the mail client considers as a legitimate mail client (authenticated and trusted mail client).
  2. We can “ask” from Exchange Online server to – send an E-mail message to “external recipient” (non-organization recipient) because, the mail client (WordPress site in our scenario) considers as “trusted client” and for this reason, the mail server will agree to relay the E-mail message to external recipients.

Exchange Online, authentication, session, TLS protocol and the hostname

Before we start, I would like to mention a couple of a unique character which is relevant for our scenario.

  1. In Office 365 based environment (Exchange Online), in case that the mail client wants to provide user credentials, the information should be “transmitted” over secure communication channel meaning – TLS protocol. This is a mandatory requirement of the Exchange Online mail server.
  2. The user credentials that the mail client provides, should be a credential of a valid Office 365 user who have a license to Exchange Online mailbox.
  3. In case that we want to address Exchange Online mail server using TLS, we will need to address the Exchange Online server using the hostname – smtp.office365.com

Scenario description – configure WordPress mail plugin to use Exchange Online as a mail server using SMTP

The characters of our scenario are as follows:

  • We need to configure our WordPress website to send an E-mail notification to our organization users. In addition, we will also need to send E-mail to our company customers (external recipients).
  • The public domain name of our organization is – o365info.com
  • Our organization purchased Office 365 subscriptions, and we want that our WordPress website will use Office 365 mail server (Exchange Online) as “his mail server.”
  • The “identity” that will be used by the WordPress website will be – support@o365info.com
  • The “Support” is a valid Office 365 user with an Exchange Online license, that has a username + password.
  • We want to configure the Postman SMTP Mailer/Email Log to address Exchange Online server using TLS and provide the required user credentials.
  • The host name of the Exchange Online mail server taht we need to
    address is –smtp.office365.com

Note – Office 365 mail server have two “identities.” The SMTP based identity and the TLS identity. When we want to address Exchange Online by using TLS, we will need to use the following predefined host name –
smtp.office365.com

You can read more information about the Exchange Online identities, in the article – Configure your WordPress site to send E-mail via SMTP mail server | GoDaddy and Office 365 based environment | Part 1#6

Send E-mail to organization recipient - Using authenticated session and TLS

Summary of the relationship between the mail client and Office 365

In the following table, we can see a summary, of the “relationship” that are our WordPress website, will have the Office 365 (Exchange Online) mail server:

WordPress site address Exchange Online as mail server - Using TLS session -table

  • To be able to “build a trust” with Exchange Online mail server we will need to provide Office 365 user credentials.
  • Exchange Online will agree to accept user credentials only if we use the TLS protocol
  • The communication port number is port 25 and in addition; you can use the port number 587.
  • The TLS version that the mail client needs to support is TLS version 1.0 and above

The WordPress mail plugin that we use

In our demonstration, we will use a WordPress mail plugin named- of Postman SMTP Mailer/Email Log mail plugin.

Install the Postman SMTP Mailer WordPress plugin

The instruction regarding the installation of the Postman SMTP Mailer/Email Log mail plugin appears in the article – Configure your WordPress site to send E-mail via Exchange Online (Office 365) anonymous session | Part 2#6.

1#4 – Configure the SMTP Mailer WordPress plugin | Send E-mail via Office 365 (Exchange Online) server using TLS protocol

In the following section, we review how to configure the Postman SMTP plugin, to use Exchange Online as a “mail server.” server”. The configuration will be implemented by providing the user credentials and by using the TLS protocol.

  • On the left menu bar, select the menu – Postman SMTP
  • Select the menu – Show All Settings

Configure mail server settings to use TLS - send E-mail via Exchange Online Office 365 - Postman SMTP -01

  • Select the – Account tab

In the following table, we can see the settings and the values that we will configure in our specific scenario:

TypeSMTPNumber 1
Transport Settings
Outgoing Mail Server Hostnamesmtp.office365.comNumber 2
Outgoing Mail Server Port25Number 3
Envelope-From Email AddressThe “sender” E-mail addressNumber 4
SecuritySTARTTLSNumber 5
AuthenticationLoginNumber 6

Outgoing Mail Server Hostname

In the field name – Outgoing Mail Server Hostname, we need to write the hostname of the mail server that we are going to address.

In our scenario, I use a “general Office 365 mail server name” that we need to use in case that we want to address the Exchange Online mail server using TLS protocol. The host name whom we will need to use is smtp.office365.com

Configure mail server settings to use TLS - send E-mail via Exchange Online Office 365 - Postman SMTP -02

Security

The security will be configured as – STARTTLS. In other words, we instruct the Postman SMTP Mailer/Email Log WordPress plugin to use the TLS protocol

Authentication

In our scenario, we must provide the required user credentials (mandatory requirement for creating a TLS session with Office 365 mail servers).

Configure mail server settings to use TLS - send E-mail via Exchange Online Office 365 - Postman SMTP -03

  • Select the – Message tab

In this section, we define the “identity” of the WordPress sender who will appear in the E-mail message that will be sent out.

In our example, the E-mail address that we will use as the “sender E-mail address”
is –support@o365info.com

Configure mail server settings to use TLS - send E-mail via Exchange Online Office 365 - Postman SMTP -04

  • Select – Save Changes

Configure mail server settings to use TLS - send E-mail via Exchange Online Office 365 - Postman SMTP -5

2#4 – Send test E-mail to organization recipient | SMTP Mailer WordPress plugin | Send E-mail via Office 365 (Exchange Online) server

In the following section, we review the process, in which we verify that the mail server settings were configured correctly and that we manage to successfully send E-mail to the destination recipient.

In our scenario, we want to verify that we successfully manage to send Outlook E-mail to the recipient from our organization.

The expected results are:

  • The E-mail message will successfully reach the Exchange Online mail server.
  • The Exchange Online mail server will deliver the E-mail message to the destination recipient (Bobm@o365info.com in our example).

Send E-mail to organization recipient - Using authenticated session and TLS

Sending test E-mail to organization recipient

  • Select the menu – Send a Test Email

Send test E-mail organization recipient - WordPress send E-mail via Exchange Online Office 365 -TLS -01

  • In the recipient E-mail address text box, provide the E-mail address of the destination recipient. In our example the recipient is Bobm@o365info.com.
    The destination recipient considers as an “organization recipient” because our organization
    is – o365info.com
  • Click Next

Send test E-mail organization recipient - WordPress send E-mail via Exchange Online Office 365 -TLS -02

In the following screenshot, we can see that the E-mail address was successfully sent to the destination recipient.

The meaning is that:

  1. The WordPress site successfully manages to contact Exchange Online mail server and provide the required user credentials.
  2. The WordPress site manages to successfully create a TLS session with the Office 365 mail servers.
  3. That the Office 365 mail server “agree” to accept the E-mail.

Send test E-mail organization recipient - WordPress send E-mail via Exchange Online Office 365 -TLS -03

Now, we want to check what happened to the “other side” meaning – the side of the destination recipient.

In the following screenshot, we can see that the E-mail reaches to Bob’s mailbox.

Send test E-mail organization recipient - WordPress send E-mail via Exchange Online Office 365 -TLS -04

3#4 – Send test E-mail to an external recipient using the SMTP Mailer WordPress plugin | Send E-mail via Office 365 (Exchange Online) server

In the following section, we will review an additional scenario, in which we want to send E-mail to the external (non-organization) recipient.

Because we configured the Postman SMTP Mailer/Email Log mail plugin to provide user credentials, Exchange Online mail server, will relate to our WordPress site as a “trusted client,” and will “agree” to deliver (to relay) the E-mail message to the destination recipient.

Send E-mail to external non-organization recipient - Using authenticated session and TLS

Sending test E-mail to external recipients

  • Select the menu – Send a Test Email

Send test E-mail external recipient - WordPress send E-mail via Exchange Online Office 365 -TLS -01

  • In the recipient E-mail address text box, provide the E-mail address of the destination recipient.
  • Click Next

Send test E-mail external recipient - WordPress send E-mail via Exchange Online Office 365 -TLS -02

In the following screenshot, we can see that the E-mail address was successfully sent to the destination recipient.

The meaning is that:

  1. The WordPress site successfully manages to contact Exchange Online mail server and provide the required user credentials.
  2. The WordPress site manages to successfully create a TLS session with the Office 365 mail server.
  3. That the Office 365 mail server “agree” to accept the E-mail.

Send test E-mail external recipient - WordPress send E-mail via Exchange Online Office 365 -TLS -03

In the following screenshot, we can see the mailbox of our external recipient. The E-mail address was successfully sent to the Gmail recipient.

Send test E-mail external recipient - WordPress send E-mail via Exchange Online Office 365 -TLS -04

Step 4#4 -verify communication with the mail server using Connectivity Test

In the current section, I would like to review a very useful and powerful feature, that the Postman SMTP Mailer/Email Log mail plugin includes.

The feature name is – Connectivity Test and the purpose of the connectivity test option is – to implement a “scan test” that will try to verify if our WordPress site can access the “mail ports” of the mail server that we want to address.

In addition, the connectivity test option will try to verify the communication channel with other public mail servers such as Gmail mail servers.

I describe the “connectivity test option” as a very useful and powerful feature because, in many scenarios, the WordPress is hosted by a web hosting provider or, located in a network that uses Firewall that block mail communication with external hosts (port 25, 587).

When using “other WordPress mail plugins” that doesn’t include this troubleshooting tool, the process of finding the cause for “send E-mail failure,” can be quite frustrating.

In a scenario, in which we don’t manage to send E-mail to the destination recipient, it’s very hard to know what is the cause of the problem.

We cannot be sure if the problem relates to the user credentials, the protocol version, the hostname of the mail server or to a problem of firewall that blocks our communication.

Using the Postman SMTP Mailer/Email Log – connectivity test

  • Select the menu option – Connectivity Test

Using WordPress to send E-mail to Office 365 – using connectivity test -Postman SMTP Mailer --01

Type the hostname of the mail server that you want to address as “your mail server”.
In our example, we address the Exchange Online mail server using the
host name – smtp.office365.com

  • Click – Begin Test

Using WordPress to send E-mail to Office 365 – using connectivity test -Postman SMTP Mailer --02

In the following screenshot, we can see the result of the connectivity test. From the results, we can see that the destination mail server is “listing” using port 25 and port 587.

The meaning is that we have an “open communication channel” to the required mail server and that the network Firewall “approve” to use these communication ports.

Using WordPress to send E-mail to Office 365 – using connectivity test -Postman SMTP Mailer --03

Configure your WordPress site to send E-mail via Office 365 or SMTP mail server| Article series index

Now it’s Your Turn!
It is important for us to know your opinion on this article

Summary
Configure your WordPress site to send E-mail via Exchange Online (Office 365) provide user credentials | Part 4#6
Article Name
Configure your WordPress site to send E-mail via Exchange Online (Office 365) provide user credentials | Part 4#6
Description
In the current article, we review how to configure a WordPress site, to address Office 365 mail by using the recommended configuration.In a scenario in which our WordPress website serves as a "mail client" that addresses mail server and asks him to be "his mail server," the best practice is to configure the mail client (WordPress site in our exhale) to provide user credentials to the mail server.
Author
Publisher Name
o365info.com
Publisher Logo
Print Friendly

Related Post

Please rate this

Eyal Doron on EmailEyal Doron on FacebookEyal Doron on GoogleEyal Doron on LinkedinEyal Doron on PinterestEyal Doron on RssEyal Doron on TwitterEyal Doron on WordpressEyal Doron on Youtube
Eyal Doron
Share your knowledge.
It’s a way to achieve immortality.
Dalai Lama

One Response to “Configure your WordPress site to send E-mail via Exchange Online (Office 365) provide user credentials | Part 4#6”

  1. Hello
    Thanks for sharing such great article. I am running into an anonymous issue with this plugin. All the settings were working fine for the past 2 months but I feel like I updated wordpress and it quit working. Its giving me a warning that its connecting to my website instead of the relay. Any help will be appreciated!

Leave a Reply

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