WPForms Blog

WordPress Tutorials, Tips, and Resources to Help Grow Your Business

how to set up WordPress SMTP

How to Get WordPress Form Notifications Using the WP Mail SMTP Plugin

by Shahzad Saeed on Dec 12, 2017

Are you not receiving email notifications from your WordPress contact forms? You can fix this issue and start receiving notifications by setting up Simple Mail Transfer Protocol (SMTP) on your site. In this article, we’ll show you how to start receiving email notifications from WordPress contact forms using any email account.

Why You’re Not Receiving Notifications

There can be a lot of reasons behind the lack of email notifications. Here are a couple of the most common:

  • Your WordPress hosting server is not configured to use the PHP mail function that WordPress uses to send emails that are generated by a contact form plugin like WPForms.
  • To reduce spam emails, your email provider often checks whether your email is originating from the location it claims to be originating from. For example, if your email server is yahoo.com, chances are your form notification won’t even make into the spam folder since they are sent out from a completely different server.

This is why we recommend using SMTP to send emails from WordPress instead of using the default PHP mail function. SMTP (Simple Mail Transfer Protocol) is an industry standard way to send emails that use proper authentication method to ensure email deliverability.

In this post, we’ll be using the free WP Mail SMTP plugin to send form notifications using a simple setup with any email account.

Note: This tutorial’s method is less secure because it stores your email login and password in your WordPress dashboard. Other WordPress administrators have access to this. For a more secure option, we recommend using one of WP Mail SMTP’s more secure options.

Step 1: Install the WP Mail SMTP Plugin

The first thing you need to do is to install and activate the WP Mail SMTP plugin. You can see this guide on how to install a WordPress plugin for step-by-step instructions.

Step 2: Configure Mail Options

After installing and activating this plugin, you need to visit Settings » WP Mail SMTP to configure settings.

Here, you’ll first be asked to enter your From Email. This is the email address that your form’s email notification should be sent from.

Note: Make sure to enter the same email address you will be using to send SMTP emails (your Yahoo, Gmail, or Live email address).

Additionally, in WPForms the same email must be used in the From Email setting for your form notifications.

Next, you can choose a From Name. By default, this will be set to the site name. If you set a different From Name in your form’s notification settings, however, that will be used instead.

WP Mail SMTP settings

Next, in the Mailer field you’ll need to select the Other SMTP option.

We also recommend checking the optional Return Path checkbox to Set the return-path to match the From Email. With this enabled, you’ll be emailed if any messages bounce as a result of issues with the recipient’s email.

Select mailer in WP Mail SMTP

Step 3: Enter SMTP Details

After selecting Other SMTP as your mailer, a new Other SMTP section will appear. Here, you’ll need to enter additional details to connect your site to your email provider.

Each email provider requires slightly different SMTP configurations. If you’re not sure what settings to use, we’ve compiled a list of SMTP configurations for popular email providers. In this tutorial, we’ll take a look at how to configure options for Gmail, Yahoo, and Live/Hotmail.

When entering your username and password for any email option, please note that this information is stored in plain text. For a more secure approach, check below the Password field for instructions on adding the password to your site’s wp-config.php file instead.

Please check out WPBeginner’s tutorial for details on how to edit wp-config.

Instructions to save passowrd more securely

Gmail SMTP Options

If you want to send notifications using your Gmail or G Suite accounts, you can use the below SMTP options.

  • SMTP Host: smtp.gmail.com
  • SMTP Port: 465
  • Encryption: Use SSL encryption
  • Authentication: Yes: Use SMTP authentication.

Then, enter your Gmail username and password and save these settings.

Yahoo SMTP Options

If you want to send notifications using your Yahoo email, you can use the below SMTP options.

  • SMTP Host: smtp.mail.yahoo.com
  • SMTP Port: 465
  • Encryption: Use SSL encryption
  • Authentication: Yes: Use SMTP authentication.

Then, enter your Yahoo username and password and click Save Changes.

Live or Hotmail SMTP Options

If you want to send notifications using your Live or Hotmail email, you can use the below SMTP options.

  • SMTP Host: smtp.live.com
  • SMTP Port: 587
  • Encryption: Use TLS encryption
  • Authentication: Yes: Use SMTP authentication.

Then, enter your Live or Hotmail username and password, and click Save Changes.

Step 4: Enable Less Secure Apps

In order to configure SMTP on your WordPress site, you may need to enable less secure apps on your email account. Let’s take a look at how to enable it on different email providers.

Enable Less Secure Apps in Gmail

To enable less secure apps on Gmail, log in to your Gmail or G Suite account. Then, go to less secure apps by clicking this link. Next to Access for less secure apps select Turn on.

gmail less secure apps to enable smtp

Sometimes for security reasons Gmail may automatically block the sign-in used by SMTP, even with less secure apps enabled. When this happens, your recovery email address will be sent an email with a sign-in attempt warning (see below).

To remove this block, you’ll need to click the Review Your Devices Now button (or visit your account’s Recently Used Devices page) and follow the instructions to let Google know this was a legitimate login attempt.

enable smtp with gmail

Enable Less Secure Apps in Yahoo

To enable less secure apps on Yahoo, log in to your Yahoo account. Then, click here to go to account security settings. Now turn on “Allow apps that use less secure sign-in”. After turning it on, the button color will be turned to green.

yahoo-less-secure-sign-in

Enable Less Secure Apps in Live or Hotmail/strong>

If you’re using Live or Hotmail email, you actually don’t have to enable less secure apps on your account to configure SMTP on your site.

Once this information is complete, go ahead and save your settings.

5. Send a Test Email

Once your SMTP settings have been added to WP Mail SMTP, it’s important to send a test email to ensure that everything is working properly. To do this, open the Email Test tab.

Send test email in WP Mail SMTP

On this tab, you can enter any email address that you have access to and click the Send Email button.

After sending the email, you should see a success message.

WP Mail SMTP test email was sent successfully

If you check the inbox for that email address, you should receive the email for this test. If you’re using Yahoo email, likely you won’t receive the test emails and form notification emails instantly. It may take about 5 to 10 minutes for them to arrive in your inbox.

Be sure to also test out your form emails by submitting a couple of test submissions after completing this setup. That way, you can check that emails deliver successfully.

And don’t forget to set the From Email in your form’s notification settings to the same email you set up this SMTP with.

That’s it! You’ve successfully configured SMTP on your WordPress site. You’ll now start getting notifications from your WordPress forms.

There are lots of different ways to configure SMTP on your WordPress site to get the form notifications. You can take a look at a few more ways to configure SMTP on your site.

What are you waiting for? Get started with the most powerful WordPress forms plugin today.

If you like this article, then please follow us on Facebook and Twitter for more free WordPress tutorials.

Comments

  1. I tried to use ‘Other SMTP’ setting but still failed. Could you please help?

    Here is the error message.
    There was a problem while sending a test email. Related debugging output is shown below:
    Versions:
    WordPress: 4.9.1
    WordPress MS: No
    PHP: 7.0.21
    WP Mail SMTP: 1.2.1

    Params:
    Mailer: mail
    Constants: Yes
    ErrorInfo:
    Host: localhost
    Port: 25
    SMTPSecure: string(0) “”
    SMTPAutoTLS: bool(true)
    SMTPAuth: bool(false)
    SMTP Debug:
    [empty]
    Please copy only the content of the error debug message above, identified with an orange left border, into the support forum topic if you experience any issues.

    1. Hi Bin,

      It looks from that debug output like the SMTP Host and Port may still need to be set. When you get a chance, would you please check that the settings match those shown under Step 3 for Gmail?

      If you give that a try and have any questions, please get in touch 🙂

  2. When I use the Jetpack Subscribe to blog I get this email instead of a confirm subscription email.

    This email was sent by Other SMTP mailer, and generated by the WP Mail SMTP WordPress plugin

    Why is this, and where is this coming from and how can I get confirmation emails properly formated to subscribers ?

  3. I went through all steps and tried to send a test email from another browser, got a “Sorry, email message could not be delivered.” message. I think this may be because I was unable to “Enable Less Secure Apps” in Yahoo. When I followed the link above and logged into security settings, there was no field below Two Step Verification for Enable Less Secure Apps for me to toggle the setting as suggested.

    Also, on my plugin settings page, there was no specific field for “Authentication: Yes: Use SMTP authentication”, only a simple on/off toggle for authentication. I left it in the on position

    Can you help?

    Thanks!

    Chris

  4. I followed the instructions per this walkthrough, but am just getting time-outs when I try to send a test email. I’m using the “Other SMTP”. Ideas?

    1. Hi Jake,

      Sorry to hear you’re running into issues with this! It’s possible there’s a conflict with another plugin, or potentially a setting on the site’s server, that’s causing this to happen. When you get a chance, would you please contact our support team? From there, we’ll be able to help investigate further.

      Thanks! 🙂

  5. I changed the settings as above and enabled less secure apps in gmail, but I am still getting the following message when I try to send a test. Any help would be amazing, thanks!

    There was a problem while sending a test email. Related debugging output is shown below:

    Versions:
    WordPress: 4.9.1
    WordPress MS: No
    PHP: 5.6.32
    WP Mail SMTP: 1.2.2

    Params:
    Mailer: smtp
    Constants: No
    ErrorInfo: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
    Host: smtp.gmail.com
    Port: 465
    SMTPSecure: ssl
    SMTPAutoTLS: bool(false)
    SMTPAuth: bool(true)

    Server:
    OpenSSL: Yes
    SMTP Debug:
    2018-01-08 10:44:06 Connection: opening to ssl://smtp.gmail.com:465, timeout=300, options=array (
    )
    2018-01-08 10:44:08 Connection: Failed to connect to server. Error number 2. “Error notice: stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Network is unreachable)
    2018-01-08 10:44:08 SMTP ERROR: Failed to connect to server: Network is unreachable (101)
    2018-01-08 10:44:08 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    1. Hi Jo,

      When we see this error, it generally means that your hosting provider is blocking the SMTP from working properly (some hosts will by default block certain ports, and this sometimes includes the ports needed for SMTP).

      There are two ways you can usually resolve this: 1) Contact your site’s hosting provider to ask them to open up that port, or 2) Use the Google API SMTP method instead (as an added advantage, this other approach is also more secure).

      I hope that helps! If you give either of these a try and have any questions, please get in touch. Thanks! 🙂

      1. Hi Jess, that has worked a treat, thank you so very very much! 🙂 Thanks also for responding so promptly. Have a great day.

      2. So glad that worked well for you, Jo! And thanks for taking the time to let me know 🙂

        Hope you have a great day, too!

  6. There was a problem while sending a test email. Related debugging output is shown below:

    Versions:
    WordPress: 4.9.1
    WordPress MS: No
    PHP: 7.0.8
    WP Mail SMTP: 1.2.2

    Params:
    Mailer: gmail
    Constants: No
    Client ID/Secret: Yes
    Auth Code: No
    Access Token: No

    Server:
    OpenSSL: Yes
    PHP.allow_url_fopen: Yes
    PHP.stream_socket_client(): Yes
    PHP.fsockopen(): Yes
    PHP.curl_version(): Yes
    Apache.mod_security: No

    Debug:
    Error while sending via Gmail mailer: {
    “error”: {
    “errors”: [
    {
    “domain”: “global”,
    “reason”: “required”,
    “message”: “Login Required”,
    “locationType”: “header”,
    “location”: “Authorization”
    }
    ],
    “code”: 401,
    “message”: “Login Required”
    }
    }

    1. Hi Iman,

      It looks like you’re using Gmail as your mailer option, so our tutorial specifically on Gmail should hopefully be more helpful to you than the article above.

      When we see this 401 error with the Gmail mailer, there’s generally an issue with the Client Secret or Client ID. Specifically, a common issue is accidentally copying in some whitespace at the end.

      When you get a chance, could you please recopy these values in from your Google account?

      If you give that a try and have any questions, please get in touch 🙂

  7. I have setup the WP MAil SMTP module correctly and am able to receive test emails, however, when I use a contact form, I never receive the emails, do I have to setup something else in wordpress in order to receive these emails.

    I am using the Divi 3.

    1. Hi Kerry,

      Generally when we see this issue, it’s because the From Email in the forms doesn’t match the email used to set up the SMTP. To check this, open the form builder and go to Settings > Notifications. Be sure the From Email here matches the SMTP email address in each of your forms.

      I hope that helps! 🙂

      1. Hi Jess,

        I am using Divi3 with the WP Mail SMTP and like I said, if I send a test email everything works fine, it simply fails to deliver anything from the Contact Form (which says delivery was OK), it is as if the Contact form is not associating correctly to the WP Mail SMTP component, is this something that can be corrected manually.

        Kind regards
        Kerry

      2. Hi Kerry,

        Once it’s set up, the SMTP will apply itself to all emails sent out from your site. In your forms, you’ll just need to make sure the From Email matches the email you set up the SMTP with. If you don’t see an option for this, or continue to see issues, be sure to reach out to Divi’s support team for assistance.

        As a third-party form option, they’ll be able to better assist. 🙂

      3. Hi Jess,

        Everything is setup correctly, for now I have had to use an alternative SMTP component, which works and was setup without touching the contact forms existing settings, we just added and configured the alternative component with the exact same settings that used for your component.

        I really do not have an answer as to why it works and your’s does not, I have sent an email to Divi but have not had a reply as of yet.

        If I get anywhere else with this I will let you know.

        Kind regards
        Kerry

      4. Hi Kerry,

        Thanks for the update, and I’ve asked our WP Mail SMTP development team to take a look, as well. If you do learn anything else, could you please drop us a message here? That way we’d be able to more easily discuss additional details if needed.

        Thanks! 🙂

  8. Hi, I followed your instructions for Office 365 and get the following error when sending a test email:

    Versions:
    WordPress: 4.6.1
    WordPress MS: No
    PHP: 5.6.32
    WP Mail SMTP: 1.2.2

    Params:
    Mailer: smtp
    Constants: No
    ErrorInfo: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
    Host: smtp.office365.com
    Port: 587
    SMTPSecure: tls
    SMTPAutoTLS: bool(true)
    SMTPAuth: bool(true)

    Server:
    OpenSSL: Yes
    SMTP Debug:
    2018-01-15 14:58:25 Connection: opening to smtp.office365.com:587, timeout=300, options=array (
    )
    2018-01-15 14:58:34 SMTP ERROR: Failed to connect to server: Connection refused (111)
    2018-01-15 14:58:34 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    Any ideas?

    Paul

    1. Hi Paul,

      When we see this ‘Connection refused’ error, it generally means that something on your site’s server is preventing the SMTP from working (possibly a firewall, blocked port, etc). When you get a chance, would you please reach out to your site’s hosting provider to ask them to check for and remove any potential blocks like this?

      I hope this helps! If you give that a try and have any questions, please get in touch. Thanks! 🙂

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.