SMTP will prevent your emails from going into the junk/spam folder of the recipients. For SMTP configuration with WordPress, you will have to install a WordPress Plugin named ‘WP Mail SMTP‘ on your website. Once the same plugin is installed and activated on your WordPress website, you will have to input the SMTP information under plugin settings.
If you’re not already signed in to your Google account, you’ll need to do so. You may also be asked to agree to the Terms of Service if it’s your first time using Google Cloud.
you’ll need to set up a new project. Click Create Project.
Enter a project name, then click on Create.
Enable the Gmail API
Next, you need to enable the Gmail API. Open the navigation menu from the top left corner of the screen. Then go to APIs & Services » Library.
On the API Library page, search for “Gmail API.” Then click on the Gmail API result.
On the next screen, click Enable.
This will turn on the Gmail API and take you to its Overview page. Here you’ll see a notice telling you to create credentials.
As you move through the rest of these screens, be sure to click Next at the end of each section. If you click Done, you will exit the setup process without completing it.
On the Overview page, click on Create Credentials.
Under Which API are you using?, select Gmail API.
Then scroll down a little to What data will you be accessing?
Go ahead and select User data.
Click Next to move on.
Now we’ll set up your App Information.
The details in this form aren’t super important because nobody else will be using your app. Here’s what we suggest:
- Type in an App name that makes sense to you.
- Pick your email from the User support email dropdown.
- You can safely skip the logo.
In the Developer contact information section, type your own email address.
Now hit Save and Continue to move on to Scopes.
Scopes aren’t required for your app, so we don’t need to use this section.
Scroll past the entire section and hit Save and Continue again.
In this section, we’re going to set up the Client ID that we need for WP Mail SMTP to connect to your Google account.
In the OAuth Client ID dropdown, select Web application.
You can change the Name if you want, but it’s fine to keep the default.
Then scroll down to the Authorized redirect URIs section. Click Add URI and paste in
https://connect.wpmailsmtp.com/google/ from the WP Mail SMTP Setup Wizard.
Hit Create to complete this step.
Find the credentials we just created under OAuth 2.0 Client IDs. Then click the pencil icon on that line.
Look to the top right of the screen and copy your Client ID & Client Secret.
WP Mail SMTP Plugin Setup
When you activate the plugin, the setup wizard will open. Click Let’s Get Started to begin.
Next, you’ll be asked to select your mailer. Go ahead and click Google / Gmail.
And now Paste the Client ID and Client Secret
Under Authorization, click the Connect to Google button.
This will open a login screen for Google. Go ahead and log in, then click the Allow button to grant permission for your site to send emails.
If you see a warning that your app is not verified, don’t worry. Free Gmail users will see this because Google hasn’t checked it. But we don’t need them to because the app won’t be used by anyone else.
Go ahead and click Advanced and then Go to example.com (unsafe).
Click on Allow button
Switch From Testing to Production (Free Gmail Accounts Only)
If you have a free Gmail account, Google will have published your app in Testing mode.
It’s super important to change this setting.
We’re going to edit your app to put it into Production. Google Workspace users don’t need to do this.
To switch from Testing mode to Production mode, go back to Cloud Console and click APIs & Services » OAuth Consent Screen in the left-hand navigation pane.
Under Publishing Status, click Publish App.
Test SMTP Plugin
Once you have updated SMTP settings, it is very essential to check if the plugin is working fine or not. Please follow the below steps in order to test the ‘SMTP Connection’ of your WordPress website with your Google account.
- Please open the ‘Test Email‘ tab (highlighted in screenshot) under ‘WP Mail SMTP > Settings’
- Please input these fields:
- To: input the ’email address’ on which you want the test email to be delivered
- Click on the ‘Send Email’ button.
Note: It would take 1-2 minutes to deliver the test email. Also, please check your spam/junk folders as well in case if you don’t get test email into your inbox.