Sending WordPress Emails from your VPS using SMTP

August 27, 2019

One of the most commonly asked questions from customers is how to fix WordPress not sending email problem. Many of our new users ask us why their contact form plugin is not sending emails, or why they are not seeing any WordPress notifications (for example, from Wordfence security plugin).

In this tutorial, we will show you how to fix WordPress “not sending email” issue.

While your WordPress VPS is configured to use PHP mail() function and actually is sending mails, not all email servers are willing to receive or pass on emails sent from an unknown source – your new VPS being one such source. It literally just appeared on the internet and started sending mails… it could be anything! So how to get around this? Well how about we pass our emails to a known and trusted email server and let them do the delivering?

You could use something like Mailgun, but that is slightly complex and costs too (have a look though if your site uses a Newsletter plugin). The better way to go for most site owners is to configure WordPress to use what is know as SMTP (Simple Mail Transfer Protocol) for delivery, as when you registered your domain you most likely got at least one email address with it. If you did not, you can ask your provider for one, or alternatively send emails via your Gmail (or other provider’s) SMTP server. Let’s look at both solutions today.

The best plugin we have ever come across for this task is Easy WP SMTP. We even use it here on this website to send you your order details when you purchase a VPS and when you contact us via the Support Contact Form. Go ahead and install this now if you are not receiving emails from your WordPress VPS and/or you want to guarantee email delivery.

The first thing to configure is general stuff like the FROM name and email address. This can be anything at all, it’s what will be displayed, not what is actually used. Here’s what we use:

Next you need to fill in the actual SMTP server details and login credentials. You can get these from your Domain Hosting Provider or figure them out yourself in the Hosting Dashboard. These are the actual login details for sending mail and must be correct.

Save the changes at this point. For basic operation you do not need to configure anything in the Additional Setting tab, so proceed to the Test Email tab.

All going according to plan, you should receive a successful test message. If not, verify you are using the correct encryption type and port number in the SMTP settings. You may need to try a different combination.

  • None – Port 25 (not secure)
  • SSL/TLS – Port 465 (secure)
  • STARTLS – Port 587 (very secure)

You should probably avoid using Port 25 if you can help it. Be sure to save and test each time you make a change.

If you wanted to use Gmail’s SMTP server to send your mails (maybe your domain registration came without email?) then here are the settings you need:

  • Gmail SMTP server address: smtp.gmail.com
  • Gmail SMTP username: Your Gmail address (for example, [email protected])
  • Gmail SMTP password: Your Gmail password
  • Gmail SMTP port (TLS): 587

You can easily find similar details for Outlook or Yahoo mail online.