WPForms Documentation

Documentation, Reference Materials and Tutorials for WPForms

How to Set Up SMTP Using the WP Mail SMTP Plugin

Have you set up forms on your WordPress site, only to find that the emails aren’t getting delivered? It’s common to see email delivery issues in WordPress, but this can be fixed by using WP Mail SMTP for reliable, authenticated email delivery.

In this tutorial, we’ll show you how to use WP Mail SMTP to fix email delivery issues on your WordPress site.


Why Aren’t Emails Getting Delivered?

There are two main reasons that WordPress emails don’t deliver successfully: server configuration and spam filtering.

WordPress, and WordPress plugins, will by default send email using the PHP mail() function. This is a simple way of sending email, and many WordPress hosting servers are not configured to use this mail() function.

In addition, your email provider checks all incoming email to determine if it should be allowed to deliver, sent to spam, or blocked entirely. One way it will do this is by checking if the email is originating from the same location it claims to be sent from.

For example, if your email server is gmail.com but your email claims to be sent from your website’s domain, your form notification may be blocked before it even reaches the spam folder.

How to Fix Email Delivery Issues

SMTP (Simple Mail Transfer Protocol) will fix email delivery issues by changing the way your emails are sent and properly authenticating them. SMTP is the industry standard for ensuring email deliverability, and WP Mail SMTP is the most flexible way to connect to many different SMTP services.

Below is a list of all of the ways you can use WP Mail SMTP to set up SMTP on your site, along with links to tutorials on each:

  • Gmail or G Suite: Works only with Google emails, more secure, no subscription
  • Mailgun: Works with any email, more secure, requires subscription
  • SendGrid: Works with any email, more secure, requires subscription
  • Other SMTP: Works with any email, less secure, no subscription

SMTP Settings Overview

SMTP must be able to connect to your email provider, which is why it requires additional setup through a plugin like WP Mail SMTP.

Unlike our other options which use APIs to allow this setup information to be stored with Google, SendGrid, or Mailgun, the Other SMTP option in WP Mail SMTP requires this setup information to be stored directly on your site.

Below, we’ll go into more detail on each of the fields required to set up an “Other SMTP” option in WP Mail SMTP.

Other SMTP: Fields Needed When Using Less Secure, Traditional SMTP

Other SMTP settings in WP Mail SMTP

SMTP Host
This is the the address to the host’s SMTP server.

SMTP Port
The most common ports are 587 and 465, however hosts can and do change these. It’s not uncommon for web hosts to block these ports, so before you begin it’s always good to verify with your web host that the required port is open. If closed, most of the time your hosting provider can open it for you.

Encryption
SSL and TLS are the most widely used encryptions. If your email provider offers both, we recommend TLS. It is worth noting that usually TLS encryption is used with port 587, while SSL is used with port 465.

Authentication
Modern email providers require authentication. Disabling it may be needed for local development or other edge case scenarios, however most providers need this turned on.

SMTP Username
Your username is typically your email address for the email provider; e.g. john@gmail.com or john@hotmail.com. Some providers such as AOL require the non-email format; e.g. if your email is john_doe@aol.com your username would be john_doe.

SMTP Password
This is your email account password. Please note although the password is not viewable in the settings, it is still stored in the database as plain text. This is required since establishing the SMTP connection requires sending the password in plaintext.

With this in mind, we highly recommend you set up your password in your WordPress configuration file, wp-config.php for improved security. For extra instructions, check out WPBeginner’s tutorial on how to edit the config file.

Here’s the code you’ll need to add:

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

Then, you’ll just need to replace your_password with your actual password. When you save the file and refresh your SMTP settings page, you should see the Password field is now slightly greyed out and disabled since it’s no longer being used.

Disabled password field

SMTP Settings for Popular Providers

When filling out the fields mentioned above, the settings you’ll need will depend on your email provider.

Here are the SMTP settings you’ll need for the most popular email providers:

Gmail / G Suite SMTP Settings

Host: smtp.gmail.com
Port: 587 (or 465 using SSL encryption)
Username: Your Gmail account email address (e.g. john@gmail.com)
Password: Your Gmail account password
Encryption: TLS

Please note we recommend using the built in Gmail integration instead of the SMTP method. If you use SMTP, don’t forget to enable less secure apps.

Outlook.com SMTP Settings

Host: smtp-mail.outlook.com
Port: 587
Username: Your Outlook.com account email (e.g. john@outlook.com)
Password: Your Outlook.com account password
Encryption: TLS

Office 365 SMTP Settings

Host: smtp.office365.com
Port: 587
Username: Your Office 365 account email
Password: Your Office 365 account password
Encryption: TLS

Hotmail SMTP Settings

Host: smtp.live.com
Port: 587
Username: Your Hotmail account email (e.g. john@hotmail.com)
Password: Your Hotmail account password
Encryption: TLS

Yahoo Mail SMTP Settings

Host: smtp.mail.yahoo.com
Port: 465
Username: Your Yahoo Mail account email (e.g. john@yahoo.com)
Password: Your Yahoo Mail account password
Encryption: SSL

Please note you will need to to enable less secure apps.

AOL SMTP Settings

Host: smtp.aol.com
Port: 587
Username: Your AOL screen name (e.g. john)
Password: Your AOL account password
Encryption: TLS

That’s it! By using WP Mail SMTP, you’ll be able to get your site’s email delivering successfully.

Still seeing issues when you try to connect with SMTP? Be sure to check out the section below for the most common questions and issues.

Frequently Asked Questions and Common Issues

My SMTP test email delivers successfully, so why aren’t my form notification emails delivering?
If your test email is successful, this means that the SMTP is all set. Instead, you’ll need to check the form’s notification settings by opening the form builder and going to Settings » Notifications. From here you can check all settings, but specifically note the From Email (remember, this must match the email used to set up the SMTP).

My site’s hosting provider is GoDaddy and I can’t get SMTP to work. What can I do?
In many cases, GoDaddy will by default block the ports required for SMTP. To address this, you’ll need to reach out to GoDaddy’s support to ask them to open up the port you need for your site.

Error: Could Not Open Socket
This usually happens when your web host is blocking the ports required to connect. Often times this is due to a firewall that is running. Contact your host and ask them to open the port being used. Also, double check the port and encryption settings, as accidentally using SSL over port 587 can trigger this error.

Error: smtp connect() failed
The connection to the SMTP host failed. Typically this error is returned when the SMTP settings are incorrect or the SMTP host is denying/blocking the connection for security purposes. Some hosting providers, such as GoDaddy, may specifically be blocking the port needed for SMTP.

Be sure to double check all of your settings, including your email and password. If the error persists, the best next step is to contact your site’s hosting provider to ask them to check for any server issues.

Error: Connection Refused
A firewall may be preventing the connection. Contact your web host and ask them to open the port being used.

Error: Mod_Security
“Not Acceptable! An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security.”

This error most commonly occurs when the server is blocking requests needed to run SMTP. To fix, you’ll need to contact your site’s hosting provider and ask them to disable specific rules within Mod_Security, which they would determine using server logs.

Error: 535 Incorrect authentication data
“SMTP ERROR: Password command failed: 535 Incorrect authentication data”

This error generally results from overly strict server permissions, which your hosting provider should be able to help resolve. For WHM/cPanel server management, you can specifically ask your site’s hosting provider to switch the “Restrict outgoing SMTP to root, exim, and mailman” setting from “On” to “Off”.