I don’t know what’s your level of frustration when you have to test emails from local hosts, but there is no suitable way to test it on the local sites, and you don’t want to check it on the live sites due to a lot of unknown facts, my level of frustration always remains high. I tried several methods, but none of them are satisfactory. After investing a vast amount of time, I finally figure out something handy and easy peasy solution to test the email setup on local hosts. In this article, I will share my learnings with you.

Required Things

To manage the work, you need only three things. 

  • WordPress on your Local Host
  • SMTP plugin
  • An account on Mailtrap

What is Mailtrap?

How to Test Emails from Local Hosts 1
Local Host Email Testing Tool: Mailtrap

Mailtrap is a fake SMTP server tool that allows you to test your local hosts’ emails decently. It grabs emails from the Local Host, Stage, QA, etc., and help you to test, preview, and debug your HTML emails.

In my words, Mailtrap will give an email box with a dedicated email id with extensive functionality to test emails from local hosts or staging sites.

The best part is, they have a free version to test up to 50 emails in your dedicated email box. Even when your email box will be full, you can remove emails and test new emails too.

Creating an Account on Mailtrap

Creating an account on Mailtrap is so easy. You can signup with your Google account/Github account, or create a new account through your email address, a new account.
Here is a video demonstration👇

Setting Up the SMTP with WordPress Plugin And Connet with Mailtrap

I don’t take your time to go with the basics of the SMTP plugin. You can find the details of those plugins on their websites. Among all of the SMTP plugins, there are a few are supported by Mailtrap. Here are those,

WP Mail SMTP by WPForms
Easy WP SMTP
Post SMTP Mailer/Email Log
Email Subscribers & Newsletters

Setting up Mailtrap with WP Mail SMTP by WPForms to Test Local Hosts Emails

WP Mail SMTP is a free plugin to set up the mail SMTP in the WordPress system. The setup process is so easy. Follow the below steps,

Step 1

Search on WordPress Repository, Install and activate it.

How to Test Emails from Local Hosts 2
WP SMPTP Plugin

Or you can download the zipped file and extract it on your WP Content Folder to save your time 😉

Step 2

Now navigate to settings option of the WP SMTP.

email-testing-with-WP-SMTP-Gtarafdar
Setting Page of WP SMPTP Plugin

Tips:
If you find the From email field filled with your admin email, please remove it and keep it blank. The WP SMTP plugin will set the default email address for you, which will help you to send emails to your Mailtrap mailbox. In my case, it causes difficulties in testing emails.

Step 3

Now select the Other SMTP option and set the below-mentioned options and login to your Mailtrap account & open your demo email box to get the necessary Infos.

Mailtrap Setup for testing emails from local host
WP SMTP Plugin Other SMTP option

Steps to follow 👇

SMTP hostname: smtp.mailtrap.io
SMTP port: 25 or 465 or 587 or 2525
Encryption method: keep them as it is 
Set Username and password to authenticate: Available on Mailtrap’s Demo Inbox Set up the page
Click Save Changes Button
Mailtrap Setup For Testing Emails on Local Host
Demo Inbox of Mailtrap

Step 4

Note that in this case, your password will be stored in the website database in plain text. This why for extra security it is recommended to set up the password in your wp-config.php file by adding these two lines of code:

Step 5

All setup is done. It’s time for testing. To test your whole work navigate to Email Test tab of the WP SMTP Plugin.

Test email in local host
Email Test Tab of WP SMTP Plugin

Now copy email address from Email Address Tab of the Demo Inbox of your Mailtrap

Test email in local host
Mailtrap Demo Inbox’s Email Inbox Tab

Paste the email address to Send To email field and click send button.

local host setuup for email testing
Pasting Email ID to email field

Hola your test email is in your mail box…

Testing Emails from local hosts

Good News:

Mailtrap collects all emails from your localhost and will display in your Miltrap’s Inbox. So you can use any kind of email address to test.

How to Configure Mail SMTP Without Any Plugins

If you are a tech nerd and don’t want to bloat your database with unnecessary plugins, then here is a code snippet. Jump into your functions.php file and configure the WordPress SMTP settings with the following code:

The interesting fact is, Mailtrap Already create a readymade snippet for you. Go to the Demo inbox of your Mailtrap Account and from the integration Dropdown menu select WordPress and copy code and finally paste it on functions.php file and save it.

configure smtp for testing local emails
WordPress Integration of Mailtrap

Bonus Tips

Special Care for Lazy Bees like me 😉

If you don’t want to do all that to test an email body, it is only interesting to know the system status, is it functional or not. Then, you can check this free tool. This plugin will help you to track the state of the emails. It will help you to understand, does the email shoot from your environment or not.

Video Tutorial on How to Test Emails from Localhosts

If you are interested in watching the tutorial video of the whole process, then jump into it.

Ending Thoughts

I I have tried to cover all the areas to make a foolproof guideline on how to test your emails in your localhost setup. If you find any other suitable and easy solution, please let me know in the comment section. I’ll add it to the next update of my content.

Special Tips on Email Marketing

If you are looking for some quality subject lines for your Email Newsletters then pay a visit here. You will get 100+ curated email subject lines to increase your open rate.

Like
Like Love Haha Wow Sad Angry
21
Spread the love