Overview
The WP Mail SMTP plugin sends email from your WordPress site through a Google (Gmail) email address using OAuth2 authentication.
If you do not want to use a Google email address to send from your WordPress site, see this article instead.
How do I configure the plugin?
To use the WP Mail SMTP plugin with a Gmail address:
How do I allow Gmail to send from my 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.
How do I configure the WP Mail SMTP plugin?
- See the WP Mail SMTP article for instructions on installing the plugin. Once installed, use the following steps to configure it.
- Navigate to the WP MAIL SMTP > General page.
- 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.
- Choose Google / Gmail under the Mailer section.
- 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.
- Click Save Settings.
How do I add code to hide my 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
- Log into your server via FTP or SSH.
- Use one of the following articles to edit your wp-config.php file.
- Scroll down in this file to the following line:
/* That's all, stop editing! Happy blogging. */
- 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' );
- Save the file. When you view the plugin page, your credentials are no longer accessible in the dashboard.
How do I 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
- How to log into your WordPress site
- Managing WordPress plugins
- Managing WordPress themes
- Troubleshooting WordPress contact forms
Third-party links
- Google Workspace / Gmail - WP Mail SMTP Documentation