WordPress Email Configuration for Sending an Email
Posted in: Email, WordPress

WordPress Email Configuration for Sending an Email

If you are facing any issue in sending an email in WordPress, then this guide is for you. Here, we discuss how to configure your WordPress so it can send the email properly.

The email configuration that may work for you will depend upon the hosting provider. So, we take two different cases either when you use shared hosting of GoDaddy, Hostgator, etc. where you have access to cPanel or when you use VPS (Virtual Private Server) like Digital Ocean, Linode, or Vultr, etc.

Here, we use a plugin WP Mail SMTP by WPForms to configure the sending of an email. This plugin fixes the delivery of an email by reconfiguring the WordPress to make use of the correct SMTP provider when sending the emails.

More specifically, this plugin reconfigures the wp_mail() function of WordPress to make use of the proper SMTP host credentials. By default, WordPress makes use of PHP mail() function for sending emails which may not work in some cases.

In VPS hosting, you may use Gmail SMTP, Pepipost SMTP, or SendGrid SMTP, etc settings for sending emails.

But, in the case of shared hosting providers, generally, they restrict you from using SMTP providers like Gmail.

First of all, install and activate the “WP Mail SMTP by WPForms” plugin, then proceed to next step depending upon the type of hosting you use.

Email Configuration in cPanel Powered Shared Hosting

This should also work in managed WordPress hosting as offered hosting providers in this category.

Here, you can set the “Mailer” to “Default (none)” and then click on “Save Settings”. This will simply reconfigure the wp_mail() function of WordPress.

WP Mail SMTP - PHP
WP Mail SMTP – PHP

Then, you can test sending of an email in the “Email Test” tab.

WP Mail SMTP - Send Test Email
WP Mail SMTP – Send Test Email

If this does not work for you, then you can try using “Other SMTP” and input the SMTP details as provided by your hosting provider.

Generally, in shared hosting with cPanel, you get this SMTP details in the “Email Accounts” section of your cPanel.

Email Configuration in VPS (Virtual Private Server)

In VPS like Digital Ocean, Linode, etc., you can use SMTP providers like Gmail. Also, the hosting provider of VPS does not block Gmail SMTP in most cases.

Here, we are going to take Gmail as an example. Select “Other SMTP” in “WP Mail SMTP” plugin and input the Gmail SMTP details. These are as follows:

  • SMTP Host: smtp.gmail.com
  • Encryption: TLS or SSL
  • Port: 587 or 465
  • SMTP Username: Your Gmail account username or email address
  • SMTP Password: Your Gmail account password

Lastly, you will also need to allow less secure apps. This is specifically the case in Gmail. So, turn on “Allow less secure apps”.

https://myaccount.google.com/lesssecureapps?pli=1

After, allowing less secure apps, you can test sending the email.

Similarly, you can configure any other SMTP providers beside Gmail.

Leave a Reply

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