How do I send email from my WordPress website with Gmail?
If you use Gmail, you can have the email from your WordPress website sent through your Gmail account. This way, completed contact forms and security notifications arrive more reliably. You do this with the free WP Mail SMTP plugin and your own app in the Google Cloud Console. If you do not use Gmail, see How do I send email from my WordPress website with Easy WP SMTP?
Before you start
- You are logged in to WordPress; see How do I log in to WordPress from DirectAdmin?
- In your browser, you are logged in only to the Google account you want to send from. Log out of other Google accounts.
- The names in WordPress are those of WordPress in English. If your WordPress is in Dutch, they are Plugins › Plugin toevoegen, Nu installeren, Activeren, Instellingen, E-mailadres afzender, Naam afzender, Client-ID, Geheime sleutel van de client, Instellingen opslaan, Sta de plugin toe e-mails te verzenden met het Google-account, Tools, E-mailtest and Verstuur e-mail.
- The names in the Google Cloud Console and on the screens of your Google account are those from the WP Mail SMTP guide. The screens of your Google account may show them in Dutch.
Install the plugin
Open Plugins › Add Plugin
In the menu on the left, click Plugins and then Add Plugin.
Find the plugin
Type
WP Mail SMTPin the Search Plugins field.Install the plugin
For WP Mail SMTP, click Install Now.
Activate the plugin
Click Activate.
Create an app in the Google Cloud Console
Open the Google Cloud Console
Go to the Google Cloud Console. If you are using it for the first time, accept the terms.
Create a project
Open the project picker in the bar at the top and click New project. Give the project a name and click CREATE.
Enable the Gmail API
In the menu, go to APIs & Services › Library. Search for Gmail API, open the result and click Enable.
Click Create credentials
On the Gmail API page, click Create credentials. At Select an API, choose the Gmail API, choose User data and click NEXT.
Enter the app details
Enter a name for the app, your email address at User support email and your email address at Email addresses. Click SAVE AND CONTINUE. Skip the Scopes step with SAVE AND CONTINUE.
Create the OAuth client
At Application type, choose Web application. Under Authorized redirect URIs, click + ADD URI and enter
https://connect.wpmailsmtp.com/google/. Click Create and then Done.Publish the app
Go to APIs & Services › OAuth consent screen and open the Audience tab. At Publishing status, click PUBLISH APP and then CONFIRM. If you use Google Workspace, click MAKE EXTERNAL at User type, choose In production and click Confirm.
Copy the Client ID and the secret
Go to APIs & Services › Credentials and, under OAuth 2.0 Client IDs, click the pencil. Copy the Client ID. Under Client secrets, click + Add secret and copy the new secret, without spaces before or after it.
Connect WP Mail SMTP to Gmail
Open WP Mail SMTP › Settings
In WordPress, in the menu on the left, click WP Mail SMTP and then Settings.
Enter the sender
At From Email and From Name, enter the address and the name your website sends email from.
Choose Google / Gmail
At Mailer, choose Google / Gmail.
Paste the Client ID and the secret
Paste the Client ID at Client ID and the secret at Client Secret.
Save the settings
Click Save Settings.
Connect your Google account
At the bottom, click Allow plugin to send emails using your Google account, log in to Google and click Allow. If Google says the app has not been verified, click Advanced, then Go to wpmailsmtp.com (unsafe) and then Allow. That is safe here: you created the app yourself.
Any questions? Contact us (in Dutch).
Related articles
Thank you for your feedback.

