While you are working on WordPress, you might want to send emails to your clients using a different email address other than the default (email@example.com). To achieve that, you need an email account and an SMTP service that connects your server and application and allows you to send emails after configuring WordPress SMTP.
Today, I am going to tell what is SMTP and how you can set up an SMTP service on WordPress. It will only take a few minutes of your time, and before you know it, you will be done!
What is SMTP?
The term SMTP stands for Simple Mail Transfer Protocol. It is a service used to send out emails from a client to a server or in between email delivery among different email accounts.
A number of WordPress SMTP plugins allow you to configure and send all outgoing emails via SMTP service provider. This will prevent your emails from going into the junk/spam folder of the recipients.
As far as WordPress is concerned, I believe that SMTP is a good alternative to PHP mail function. Once configured properly, it will send all outgoing emails via SMTP server ensuring that the email is coming from an authorized source.
In my example, I will guide on:
- Gmail SMTP on WordPress
- SendGrid SMTP on WordPress
- MailGun SMTP on WordPress
- Setup SMTP Service on Server
However, the steps will be more or less the same, if you go with some other SMTP provider.
Before setting up SMTP, you need to read these precautions carefully.
- If you have enabled Two Factor authentication on your Gmail account. You need to generate a special password and note it down as it will be required for different password fields. Here is the step by step guide on how to generate an app password.
- If you have not enabled the Two-Factor authentication, then you just need to allow access to less secure apps from here. Just click on the Turn On button.
So without further ado, let’s setup SMTP on our WordPress hosting Server first.
First of all, you need to authorize your server to access your Gmail account. If you have merged more than one account on Gmail, Login with the main account and open this link, and click on “Continue”.
Configure Gmail SMTP on WordPress
First of all, you need to install an SMTP plugin from WordPress dashboard. You can find many SMTP plugins in the WordPress plugin repository. However, in my example, I will be using one of the most popular plugin known as the WP Mail SMTP plugin.
As soon as you install and activate the plugin, you will see a new label titled WP Mail SMTP right underneath the Settings.
There are three steps for setting up this plugin. Let’s cover these steps one by one.
Step 1: Enter Email Address
Enter the email address you wish to use for your outgoing emails and the name which receipts will receive the emails from. Then from the Mailer options, select Gmail as our SMTP service provider.
Step 2: Configure Gmail
This step involves the configuration of Gmail. Log in to Google developer console with your Gmail ID, create a project and enable the Gmail API for your WordPress site.
Click Go to credentials to get the credentials required for setting up your Gmail SMTP on WordPress.
Choose the options as shown below:
Click What credentials do I need? button to proceed to the final step towards getting your client ID.
- For the Name provide any name of your choice
- For Authorized redirect URL, copy the URL from WP Mail SMTP setting page.
Now click Create client ID and on the next page check your email address and the Product name to verify your details then click Continue.
Click on I’ll do this later and on the next screen, click Edit to reveal Client ID and Client Secret.
Copy these and go back to WP Mail SMTP plugin dashboard and paste it under Gmail settings.
Click Save Settings button. Now I need to authorize the WP Mail SMTP plugin to use our Gmail account for sending emails.
While authorizing, you may get a warning. It is because my domain name does not has an SSL certificate installed. To avoid this, you need to add SSL certificate to your WordPress site.
Once allowed, navigate to Email Test tab at the top to test your newly configured Gmail SMTP email.
Step 3: Send Test Email
Once successfully installed and configured Gmail SMTP on WordPress, I will now move ahead to the testing stage. Let’s see how the results look like. Simply, enter an email and hit the Send Test button.
And I’m sure, you will get the email like below:
And that’s all! But before I move further, let me assure you that Gmail for FREE restricts you to send only 500 emails or 500 recipients per day. If you want more, then try using any other premium SMTP provider that has fewer limitations. The steps are the same as above for other providers, and you just need to configure the settings as per the SMTP provider.
Configure Mailgun SMTP on WordPress
Mailgun is an email automation service which is owned by Rackspace. Mailgun is also considered as one of the best SMTP providers for WordPress. It allows you to send, receive, track and store emails easily. It can be used to send newsletters, notifications, or anything you want to distribute among your email database.
Another advantage is that it allows you to send 10,000 emails per month for FREE. If you need more emails, they have an excellent pricing model.
First of all, you need to have an account with Mailgun. Get one from here. Once created, log in to your Mailgun account. It will take you to the Mailgun dashboard. Since I want to use my domain name for sending emails. I need to add my domain name on Mailgun. From the top menu bar, go to Domains and click on Add New Domain.
Once added, Mailgun recommends to verify the domain name just for the authenticity. Here is an excellent guide on how you can verify domain for Mailgun.
Here are the few reasons, why you need to verify the domain.
- To prove that you are an authorized sender for the domain.
- Verified domains are not subject to a sending limit of 300 emails per day.
- No more sent via Mailgun.org message in your emails.
- Establishing a positive email reputation for your own domain.
- Mailgun is less suspicious of traffic that is being sent on verified domains and so using one reduces the likelihood of being disabled.
I assume that you have followed the guide and verified the domain name. Click on domain name and you will be redirected to Domain Information tab.
Copy the API Key and paste it into the WP Mail SMTP plugin. To enter the correct domain name, visit here and copy the exact domain name.
Don’t forget to click Save Settings at the bottom of the page. Now, navigate to Email Test tab at the top and send a test email to your desired recipient.
You should get an email like below:
Note: I have not verified my domain name but still I get the email. I would suggest you get your domain verified to get advantages Mailgun offers to a verified domain.
Configure SendGrid SMTP on WordPress
Just like Mailgun, SendGrid is a cloud-based one of the best SMTP service providers. It allows you to send and receive bulk emails. SendGrid can be used for marketing campaigns and transactional emails without worrying about the emails are marked as spam.
They are also popular because of their customer database, over 58,000 paying customers use SendGrid to send more than 35 billion emails every month.
SendGrid also offers free to try, Essentials that includes 40,000 email, free for 30 days and send 100 emails/day for free forever.
First thing first, you need to create an account with SendGrid.
Note: Be sure to Sign up with the same email address you’d like to set the From Email. These emails will need to match in later steps.
I assume, you have created an account with SendGrid and logged into the SendGrid dashboard. From the left pane, open the drop-down and get into the Setup Guide, click on Start where it says Integrate using our Web API or SMTP Relay.
Choose SMTP Relay from available options.
On the next screen, SendGrid will ask the name of your API key. Name it anything you want, and click on Create Key.
Copy and paste the above key in WP Mail SMTP plugin and click Save Settings.
Go to the Email Test tab, enter the email address where you want to receive a test email. And, you should get an email like below.
Get back to the SendGrid dashboard, check the below box, and click the Next: Verify Integration button.
On the next screen, click on Verify Integration and you will get a success message.
Verify Domain & Email Links
Again, just like Mailgun, SendGrid also recommends to verify the domain names as well as Email links to ensure the delivery of your emails. In SendGrid, they are called as Whitelabeling.
Setup SMTP Service on Server
For instance, you have a number of WordPress applications and want to use the same SMTP service on all of them. Then, you need to set up the SMTP on the server instead of setting it up on each WordPress site.
If you are a Cloudways customer, you can follow the below steps to set up Gmail SMTP and/or any custom SMTP service provider.
Before setting up a Gmail SMTP on the server, you need to read these precautions carefully.
- If you have enabled Two-Factor authentication on your Gmail account. You need to generate a special password and note it down as it will be required for different password fields.
- If you have not enabled the Two-Factor authentication, then you just need to allow access to less secure apps from here. Just click on Turn On button.
So without further ado, let’s setup Gmail SMTP on our Server.
First of all, you need to authorize your server to access your Gmail account. If you have merged more than one account on Gmail, Login with the main account and open this link, and click on Continue.
Configure SMTP on Server
Login to your Cloudways account, and click on the Servers tab located at the left corner of the top admin bar and get into your server. From the left pane, go to SMTP tab, and select Your Own SMTP option from the drop-down list.
When clicked on the link Your Own SMTP, it will ask you to select the SMTP provider. In my example, I will use Gmail SMTP which is not on the list so I going to select Other to connect my applications with the server and here are my configurations:
- Host: smtp.gmail.com
- Port: 587
- Username: My Gmail Email ID
- Password: My Gmail Password (or App Generated Password)
By following the same steps, you can configure any third party SMTP service provider.
Why Should You Use SMTP on WordPress Separately?
Since all the applications on server use this default SMTP setting. You might need to set up separate email configuration in other applications. For this, you can use any WordPress SMTP plugin and configure it accordingly which will override the default SMTP settings and send emails using your customized settings.
We are now done with setting up the SMTP successfully to create an active communication channel between SMTP provider and all applications.
If you have any query or stuck in any step, feel free to comment below. I would like to help you out!
Frequently Asked Questions
Q1. What is SMTP host?
SMTP is the acronym for Simple Mail Transfer Protocol , literally “simple mail transfer protocol”. This is the protocol used to forward emails to email servers. By extension, SMTP also refers to the servers and relays used for the transfer of these emails.
Q2. What is the SMTP mail server?
SMTP is primarily a communication protocol, i.e., a set of rules used to transfer emails to email servers.
Mustaasam is the WordPress Community Manager at Cloudways - A Managed WordPress Hosting Platform, where he actively works and loves sharing his knowledge with the WordPress Community. When he is not working, you can find him playing squash with his friends, or defending in Football, and listening to music. You can email him at firstname.lastname@example.org
Be the first to check out WordPress 5.0
Use our Staging feature before upgrading your website to WordPress 5.0.