Simple Mail Transfer Protocol (SMTP) is an Internet standard for electronic mail transmission. In this tutorial you will learn how to set your WordPress installation to use SMTP for email notifications delivery.
Alternative to SMTP is “PHPMailer” and WordPress uses it by default to send email notifications. Although it generally works and you might not have any bad experience with it, PHPMailer is far from perfect.
First you will have to create an email address that your WordPress will use to send email notifications. Preferred email name is usually [email protected] or something self-explanatory such as [email protected] or [email protected], but it can be anything you want.
You can also use email address unrelated to the domain your WordPress is using, but I personally don’t prefer that.
Login to your hosting panel (whatever it is) and create the email address you want. You can use your existing email address with inbox as well but I suggest that you go with dedicated email which will be used only for SMTP delivery.
Speaking in general terms, this will reduce the number of people who know the email password and chances that the password will be changed without your knowing.
So, in our example we’ll go with [email protected] email account. It will be dedicated to the WordPress domain which is “soulstudio.info” and it will be used only for SMTP delivery.
As you can see on the screenshot, this email has receiving completely disabled and can be used only for SMTP delivery. Again, it is up to you how you will use your address and how it will be formed.
Now we can go to the next step. Unfortunately, WordPress is still not supporting SMTP through the default settings so we’ll have to use a plugin. Download and install the WP Mail SMTP plugin from WordPress repository.
WordPress uses the wp_mail function which relies on the PHPMailer class to send emails through PHP. This plugin will reconfigure the wp_mail function to use SMTP instead.
On your WP dashboard’s sidebar go to Settings > WP Mail SMTP. There you will be able to set everything up by following my instructions provided below.
Settings of the plugin are pretty much self-explanatory. Fill in the “email” and “name” fields first. You need to enter the email you plan to use and preferred name that will be displayed to everyone receiving the email notifications.
As for mailer settings, go with “OtherSMTP”, unless you are using a third-party sender (Gmail, Mailgun or SendGrid). Choosing “Default (none)” will make WordPress use PHPMailer again, while the plugin is active.
Now we are getting to the more advanced settings part.
Set up everything according to the screenshot above (if your website is on Soulstudio host). The only difference will be your SMTP username and password.
As for the rest of the settings (host, port, SSL/TLS), it all depends on how your host is set up. You might need to contact your server administrator if you are not familiar with the settings of your server.
After you are done, press the “save settings” button.
By now you should be good to go. However, make sure you test your settings first by going to the “Email Test” tab. There you can enter any email address (must be valid) and the SMTP plugin will send you a test email by using your new SMTP settings.
If something is wrong with the test email delivery, the plugin will notify you. If you are having trouble, contact your server administrator or your hosting company’s technical support to see if all the info you entered is correct.
This is how your test email details will look like upon delivery (based on your own settings and email provider).
This is not mandatory but PLEASE do this step as well. It is for your own safety. Otherwise, your email password will be seen by anyone who has access to your WP dashboard. And even if you trust those people, their WP accounts may be hacked and the attacker will get to your email password easily, without the need to access the actual files on the server.
What you need to do is simply to remove the password from the password field in the plugin settings and add the following code to your wp-config.php file:
define( 'WPMS_ON', true );
define( 'WPMS_SMTP_PASS', 'password_goes_here' );
I usually put this code right above the “That’s all, stop editing! Happy blogging.” line.
After you do that, you can repeat the email testing to make sure all is good.