Configuring the 'WP Mail SMTP' plugin with Gmail

 

Overview

This article explains how to use the WP Mail SMTP plugin to send email from your WordPress site using your Google email address.

If you do not want to use a Google email address to send from your WordPress site, see this article instead.

Configuring the plugin

To use the WP Mail SMTP plugin with a Gmail address:

 

Allow GMAIL to send from your mail application

Log in to your Google account and enable OAuth2 authentication. This allows Google to send emails from your WordPress site. For full instructions, see this article from the WP Mail SMTP plugin's website.

Configure the WP Mail SMTP plugin

  1. See the WP Mail SMTP article for instructions on installing the plugin. Once installed, use the following steps to configure it.
  2. Navigate to the WP MAIL SMTP > General page.
  3. Fill in the following fields:
    • From Email — Enter the Google email you wish to send FROM.
    • Force From Email — Check this box.
    • From Name — Enter a name you'd like to appear as being sent FROM.
    • Force From Name — Check this if you wish to force the FROM name.
    • Return Path — Check this box.
  4. Choose Google / Gmail under the Mailer section.
  5. Fill in the following fields:

    These credentials were created in Step 1 above.

    • Client ID — Enter the string of letters and numbers you created in your Google account.
    • Client Secret — Enter the string of letters and numbers you created in your Google account.
    • Authorized redirect URI — Use the URI to input into your Google account.
  6. Click Save Settings.

Add code to hide your credentials

The instructions above add your Google credentials to the WordPress dashboard. To further secure your credentials, the plugin recommends adding code to your wp-config.php file. See this page for further details.

Adding the constants to your wp-config.php file

  1. Log into your server via FTP or SSH.
  2. Use one of the following articles to edit your wp-config.php file.
  3. Scroll down in this file to the following line:
    /* That's all, stop editing! Happy blogging. */
  4. Add the following lines just above this line. You only need to change the WPMS_GMAIL_CLIENT_ID and WPMS_GMAIL_CLIENT_SECRET entries:
    define( 'WPMS_ON', true );
    define( 'WPMS_GMAIL_CLIENT_ID', '********************.apps.googleusercontent.com');
    define( 'WPMS_GMAIL_CLIENT_SECRET', '**********************');
    define( 'WPMS_MAILER', 'gmail' );
  5. Save the file. When you view the plugin page, your credentials are no longer accessible in the dashboard.

Test the plugin

You should now test the plugin to confirm it's correctly sending emails from your Google address. For further instructions, see this article.

See also

DreamHost links

Third-party links

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?