Greetings and welcome back to yet another guide on how to integrate WordPress With Gmail for emails using WP Mail SMTP.
WordPress is one of the most popular CMSs in the world, powering over 40% of all websites on the internet. It allows users to create and manage websites easily without requiring any deep programming language. It was designed as a blogging platform but has evolved to be used for a wide range of website types, including business websites, e-commerce sites, and personal portfolios. It provides a simple and intuitive interface for creating, editing, and publishing content and allows users to customize their websites using a wide range of themes and plugins. The popularity of WordPress has been spearheaded by an extensive community of developers and users.
WordPress plugins are simply pieces of software that can be installed to add extra functionality and features to a WordPress website. The plugins are downloaded and installed from the official WordPress plugin repository or from third-party sources.
WP Mail SMTP is a WordPress plugin that makes it possible for users to configure and send emails from their WordPress website using an SMTP (Simple Mail Transfer Protocol) server. The default method for sending emails on WordPress is via the PHP mail function. This isn’t reliable and can sometimes result in delivery issues or emails being marked as spam.
The WP Mail SMTP provides a simple and user-friendly interface to set up and configure SMTP settings for email delivery. The users are required to specify their SMTP host, port, username, password, and other details required for SMTP authentication. The plugin also includes support for popular email services like Gmail, Yahoo, and Microsoft. In addition to that, users can troubleshoot email delivery issues by providing detailed logs and error messages.
Now let’s dive in and configure the WP Mail SMTP plugin on WordPress!
Prerequisites
Before you proceed, you need to have WordPress installed and running. You can follow any of the dedicated guides below:
- Install WordPress on Debian with Apache and Let’s Encrypt
- Install WordPress with Nginx on Ubuntu / Debian
- Manage WordPress Website on Linux using WordOps
Once installed, proceed as shown below.
1. Creating a Gmail App and Generating API Keys
For this guide, we will configure Gmail as the SMTP mailer. First, you need to create an App and generate the API keys for the connection to occur.
To do this, access Google Cloud Platform and navigate to My Project > New Project as shown.
For this guide, we will create a project and name it My WordPress SMTP

Once the details have been provided, click on the create button.
The next thing is to enable APIs and services for the project.

On the APIs library page, search for the Gmail API and select it.

On the below page, enable the API.
Once enabled, we need to create credentials to be used by WordPress for connections.

Click on Create Credentials and select the ‘Gmail API’ option from the dropdown menu and choose ‘User data’ for what data will you be accessing the click Next

Now set the Apps information. Give it a name, select the email address and also add a logo if you want. You also need to set the Developer contact information

Next, proceed to the consent screen. On this page, just scroll to the bottom and click ‘Save and Continue’

Now e need to set the details for OAuth Client ID. Set the application type as ‘Web Application’. Then type the name of the application.

Scroll down and add Authorized redirect URLs. On this page add https://connect.wpmailsmtp.com/google/ in the URLs field.
Hit the Create button. Then proceed and obtain the creds for the application.
You can click done. The creds will be available in the credentials tab.
To view the creds, click on the edit button.

Now, these creds will be used in the next steps for the WP Mail SMTP Plugin configuration.
2. Switch From Testing to Production (Free Gmail Accounts Only)
The app will be published in Testing mode if you have a free Gmail account. It is recommended that we push it to Production. To do this, navigate to the Cloud Console and click APIs & Services » OAuth Consent Screen in the left-hand navigation pane.
Accept the prompt.

That is it for Google configuration! Proceed with the WordPress configuration as shown below.
3. Install and Activate WP Mail SMTP Plugin
On our WordPress site, we need to install and activate the WP Mail SMTP plugin. Navigate to the Plugins tab-> Add new and search for WP Mail SMTP as shown below:





