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 Gmail address to send from your WordPress site, view the following article instead.
Step 1 — Allowing GMAIL to send from your mail application
To use a Google email address, log into your Google account first and enable OAuth2 authentication. This allows Google to send emails from your WordPress site. View the following article from the WP Mail SMTP plugin's website for full instructions.
Step 2 — Configuring the WP Mail SMTP plugin
View the WP Mail SMTP article for instructions on installing this 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 - This is a string of letters and numbers you created in your Google account.
- Client Secret - This is a string of letters and numbers you created in your Google account.
- Authorized redirect URI - You will input this into your Google account.
- Click Save Settings.
Step 3 — Adding code to hide your credentials
The instructions above add your Google credentials to the WordPress dashboard. The plugin recommends adding code to your wp-config.php file to further secure your credentials. View the following 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.
define( 'WPMS_ON', true ); define( 'WPMS_GMAIL_CLIENT_ID', '********************.apps.googleusercontent.com'); define( 'WPMS_GMAIL_CLIENT_SECRET', '**********************'); define( 'WPMS_MAILER', 'gmail' );
- The only parts you need to change are WPMS_GMAIL_CLIENT_ID and WPMS_GMAIL_CLIENT_SECRET
- Save the file.
If you view the plugin page now, you'll see your credentials are not accessible.
Testing the plugin
You should now test the plugin to confirm it's correctly sending emails from your Google address. View the following article for further instructions:
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