How to Use SMTP Server to Send WordPress Emails

How to Use SMTP Server to Send WordPress Emails

Want to deliver your WordPress emails using a SMTP server? We’ll show you how to use SMTP server to send your WordPress emails. WordPress uses PHP mail function to send emails about new user registrations, updates, comments, contact forms, password reset, etc. Due to the nature of PHP mail function, the originated emails are usually get into junk folder. Some popular email provider like gmail.com, yahoo.com  aol.com, hotmail.com, would end up blocking the emails from your WordPress based site. In this tutorial, we will show you how to properly configure WordPress to send emails using SMTP. There are many plugins for doing this, but for now we are going to use Post SMTP plugin. There are some advantages we can take when using this plugin if compared to the other similar ones, like the ability to see email log, ability to export-import configuration, etc.

1. Install Post SMTP

We assume our readers already know how to install a WordPress plugin.

2. Configure Post SMTP

To configure the plugin, go to WordPress Dashboard and click on Post SMTP.

3. Using your own email

In the Account tab, you can choose the transport for the emailing purpose. There area 6 (six) options there, now we are going to choose SMTP. And to be able to use SMTP, you will have to have an email account hosted with us.

If you have an active subscription with us and also have a control panel on your server, you can use your email address as SMTP username.

For cPanel users, you can create an email account in Email accounts – Add Email account
For DirectAdmin users, you can create it in User level. Click on a domain name – E-mail Accounts – Create mail account.

But, if you don’t have a control panel on your VPS with us, you can always contact our support staff to ask for help.

4. SMTP Details

We assume that you already have an email account, please use the following configuration, modify them to reflect your credentials.

Outgoing Mail Server Hostname: mail.domain.com
Outgoing Mail Server Port: 587
Envelope-From Email Address: you@domain.com
Security: STARTTLS
Authentication: Plain

In the authentication section, fill the username and and its password. Please note that the username is usually the same as the Envelope-From Email Address.

Click on ‘Save Changes’ button.

At this point, if your configuration is correct, you are able to send emails. Click on ‘Send a Test Email’ to make a test.

5. Using Google Mail

If you choose this option, you don’t have to make changes to the saved configuration if you change the email account’s password one day. Your configuration will still work even if you periodically change your Gmail password.

To use Gmail API, you first need to log into https://console.developers.google.com/start/api?id=gmail with the same email address that you are configuring Post SMTP with. There, you will be asked whether to use an existing project or create a new one, let’s create a new project instead.

How to Use SMTP Server to Send WordPress Emails Using Gmail API

In the next page, you will see that the API is enabled, let’s click on ‘Go to credentials’ to continue.
You will be asked the following:

Which API are you using?
Where will you be calling the API from?
What data will you be accessing?

Let’s use GMAIL API, Web server (e.g. node.js, Tomcat), and User data as the answers.
Click on ‘What credentials do I need?’

Next step, we will create an OAuth 2.0 client ID. There, you will need to fill Authorized JavaScript origins and Authorized redirect URIs. Fill the forms with the ones provided in your GMAIL API Post SMTP page, then click on ‘Create client ID’

In the next step, the consent screen page, you need to choose the email address you want to send emails from and fill the product name, click on continue. You will be brought to the final page, where you can see the Client ID and Client Secret.

Go back to your Post SMTP setting, and fill the Client ID and Client Secret you have.
Click on ‘Save Changes’

At this point, you will still need to allow your application (WordPress) to access your Gmail account.
After clicking on ‘Save Changes’ button, click on ‘Grant permissions with Google’ to continue.

Once you approved, your WordPress website is able to send emails using Gmail SMTP.
Go back to Post SMTP configuration page and click on ‘Send a Test Email’ to make a test.

6. Using Mandrill

You have to create an account at mandrill.com and enter an API key.

How to Use SMTP Server to Send WordPress Emails with Mandrill API

7. Using SendGrid

You have to create an account at sendgrid.com and enter an API key.

How to Use SMTP Server to Send WordPress Emails with SendGrid API

8. Using Mailgun

You have to create an account at mailgun.com and enter an API key.

How to Use SMTP Server to Send WordPress Emails Using MailGun API

That’s it all, your WordPress website is configured to send email using SMTP instead of the PHP mail function. To troubleshoot any issues you may face when using this plugin, you can always check the mail log, doing connectivity test or diagnostic test from the plugin’s configuration page.


How to Set Up SMTP Server to Send WordPress EmailsOf course you don’t have to do any of this if you use one of our WordPress VPS Hosting services, in which case you can simply ask our expert Linux admins to update your WordPress installation, plugins or themes for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment