Using SMTP to send emails from WordPress
By default email from your WordPress site will be sent using PHPmail by your hosting server. In theory this is quick and requires no setup from you. However, emails sent this way are not 'authenticated' - see our guide on mail authentication - SPF, DKIM and DMARC.
This lack of authentication may mean your emails will be blocked before they reach their intended recipient.
The way around this is to use SMTP mail. In WordPress this is accomplished by the use of a plugin. We suggest WP Mail SMTP (external link opens in a new window).
You'll need to be logged in to WordPress as an Administrator, or have sufficient privileges to be able to install a plugin.
You will need the login and configuration details of a cPanel mailbox to use in the following guide - this will ultimately be where your emails will be sent from. If you don't have those you can either find the configuration details for an existing mail account or create a new account.
- From the WordPress dashboard, select Plugins > Add New or from the Plugins screen click the Add New button.
- Start typing wp mail smtp into the search box and the correct plugin should show up in the results.Click the Install Now button.
- Once the plugin has installed click the Activate button.
- Access the settings for the plugin - either via the left hand menu or by clicking the Settings link below the plugins name.
- On the General tab scroll down to the Mailer section and select Other SMTP.
- You'll see a section appear below now title Other SMTP.You'll need to enter the details for the mailbox you'd like to use to send emails.
SMTP host: will be either mail.yourdomain or your hosting server's name
Encryption: ideally set to TLS (or SSL)
SMTP port: 587 (or 465 if using SSL)
SMTP Username: the email address of the mailbox being used to send emails
SMTP Password: the password of the mailbox being used to send emails
Click Save Settings to save these details.
- Take note of the message about the password being stored in plain text.
We'd suggest completing the next step of testing that the settings are all working. Then updating your
wpconfig.phpwith these edits and then testing again to make sure everything has stayed working.
- Scroll to the top and click the Email Test tab.Enter an email address to Send To: and choose whether to send an HTML email or not.
Click Send Email.
If all is well you'll see a green success banner.
If there are any problems you'll see a red banner detailing the problem. You'll need to fix this before returning here to test again.
- Now, edit your
wpconfig.phpfile to include the password - add the following two lines
define( 'WPMS_ON', true );just above the line
define( 'WPMS_SMTP_PASS', 'your_password' );
/* That's all, stop editing! Happy publishing. */Change
your_passwordfor your mailbox password.
- Once you've added those lines to
wpconfig.phpyou should return to the General tab and remove the SMTP Password and click Save Settings.
The field will now appear greyed out - but still show the password stars.
- Finally switch to the Email Test tab again and send another test email to confirm the details have been added to
Any email sent from your WordPress site, including from contact form plugins will now be sent via authenticated SMTP email.