My HP

11th April, 2018 | Getting Started |

How To Use The SMTP Server To Send WordPress Emails

Are you having trouble receiving or sending emails from your WordPress site? - In this article, we will show you how to use an SMTP plugin to send WordPress emails instead.

Setting up an email address

First, if you don't already have an email address you'd like to use (to send out mail from your WordPress site), you will need to create an email account. For the sake of this example, we will show you how to create an email account in cPanel. If you already have an email address you'd like to use, please skip to the next step: Setting up SMTP in WordPress

Log into your cPanel account. If you are unsure on how to do this, please view the following help article - 'How to log into cPanel', Then under the Email heading, click on Email Accounts"


Once on the Email Accounts page, click on the blue Create button


On the Create screen, enter the first part of the email address you'd like in the Username box. In this example we've used "wordpress" as we'll be using this only to send emails from the WordPress site.

Click on Generate to the right of the Password box, this will then generate a random strong password for you to use. Remember to make a note of this now, as the password cannot be viewed once the email address has been created, only reset / changed to a new password.  Alternatively you can enter a password of your choice in to the Password box, and the system will accept this as long as it meets the strength requirements, which are shown below the box.

Finally, click on the blue CREATE button to create the new email address


You will then be taken back to the Email Accounts page, where you will see the new email address listed (In this example: wordpress@mydomain.com)

We will now need to grab the server settings for this email address, ready to add in to the SMTP plugin on the WordPress site.  To find these click on the Connect Devices button to the right of the email address


You will then be shown the server settings for the email address - make a note of the settings shown in the blue Secure SSL/TLS Settings (Recommended) box, or alternatively leave the page open in your web-browser to refer back to.


Setting up SMTP in WordPress

You will now need to install and activate the WP Mail SMTP plugin within your WordPress site.  Firstly log in to your WordPress site dashboard - This will normally be at a url such as mydomain.com/wp-admin  (replacing mydomain.com with your own domain name)

Once logged in, hover over Plugins on the left menu, then click on the Add New option


Next, In the Search box in the top left of the screen, enter wp mail smtp then press enter. This will search for the plugin from the WordPress plugin repository, and also show related plugins in the search result.

You should see WP Mail SMTP by WPForms appear as the first result. Click on the Install Now button to install the plugin on WordPress


Once installed, the button will change to a blue Activate button. Click this to activate the plugin.


You will then be taken back to the installed plugins page. You will see the WP Mail SMTP plugin here (highlighted blue to denote that it is active).

Next we will need to adjust the settings within the WP Mail SMTP plugin. Hover over WP Mail SMTP on the left hand menu, then click on Settings


This will then take you to the general settings for the plugin. As shown in the image below, you will want to adjust the following.

From Email - Set this to the email address you want to send from. In this example we are using wordpress@mydomain.com

  From Name - Set this to the name you'd like the email to sent from. In most cases you would enter your website name here, or something applicable so that recipients know where the email has come from.

  Mailer - Click on the Other SMTP option to select this option.

 


Once Other SMTP has been selected, the SMTP server settings boxes will appear below this on the page.  This is now where you will want to fill in settings, using the server settings information noted whilst setting up the email address earlier in the tutorial. If you skipped this step,  go to the Server Settings section of the tutorial to see how to find these on your cPanel hosting.

SMTP Host: This will be the server name (Listed as "Outgoing Server" on the server settings you saved earlier)

  Encryption: Set this to SSL

  SMTP Port: This will be the SMTP port shown on the server settings - normally 465

  SMTP Username: Enter your full email address here. For this example it would be: wordpress@mydomain.com

  SMTP Password: Enter the password for the email address here

  Once done click on the Save Settings button to save the SMTP settings.


Now that you've set up the SMTP plugin within WordPress you may want to test to ensure it's working correctly.

To do this, at the top of the WP Mail SMTP settings page, click on Email Test

On this page, in Send To box, enter an email address that you would like to try sending to.

Once done, click on Send Email


If this was successful, the page will then show a Test HTML email was sent successfully! message, like in the example image below.

You will then want to check the email address you tried sending to, in order to make sure the email came through ok.

If the email was received then you're good to go!


Securing Your Email Password

You may have noticed that WP Mail SMTP has a warning within its settings, stating The password is stored in plain text. We highly recommend you set up your password in your WordPress configuration file for improved security. 

To do that, you will need to add some code to your sites wp-config.php file.

First, you will need to connect to your hosting using an FTP client or the File Manager page in cPanel. Once connected, you will find your wp-config.php file in the root folder of your website (normally public_html for the main domain on your hosting).

You can edit this file using any plain text editor like Notepad or TextEdit, or via the Edit function with File Manager on cPanel.

Locate the line that says ‘That’s all, stop editing! Happy blogging’ and add the following code just before it.

1
2
define( 'WPMS_ON', true );
define( 'WPMS_SMTP_PASS', 'your_password' );

Don’t forget to replace ‘your_password’ with your actual SMTP password. After that, save and upload your wp-config.php file back to the server, or click on save changes if editing from within the File Manager.

You can now visit your WordPress admin area and go to the WP Mail SMTP settings page. Scroll down to the SMTP options section and you will see that the password field is now disabled.

Comments