Gmail or Google Workspace with FluentSMTP

Fluent SMTP is a plugin that takeover WordPress’s default mailing system and ensures email delivery from the website and also keeps logs of them. The unique feature of Fluent SMTP is that it can be configured with multiple email delivery methods(connections) and all of them can be used later by configuring the Mail From address.

Google is one of the best email delivery methods available in the market. Both Free and Paid (Google Workspace formerly known as GSuite) emails can be configured with Fluent SMTP. In this tutorial, we are going to configure Fluent SMTP with Google.

Configuring Fluent SMTP with Gmail or Google Workspace Emails #

Please follow the below sections to configure Gmail or Google Workspace Emails with Fluent SMTP.

Add New Google Workspace Connection #

If you already have any other configured connection, then you will be in the Fluent SMTP Dashboard.
Please go to WordPress Settings ⮕ Fluent SMTP ⮕ Settings ⮕ Add Another Connection

If you haven’t set up any SMTP Connection yet, you will be directed to configure a connection automatically.
Now from your WordPress Dashboard go to Settings ⮕ Fluent SMTP

Google Workspace Connection Properties #

After selecting Google Workspace as the mailer, a very simple settings window will open as shown in the screenshot below.

In this part, we need to provide From Email, From Name, Application Client ID, and Application Client Secret where the Client ID & Secret has to be obtained from the Google Cloud Platform for the From Email we are going to use for this Google Workspace Connection. We will obtain those credentials from the following steps.

Please copy or keep note of the Authorized Redirect URI which we will need later.

Obtain Google Cloud Application Client ID & Client Secret #

The Application Client ID and Client Secrets are parts of the Google Cloud Application. We need to:

  1. Create a Project for Fluent SMTP.
  2. Enable Gmail API.
  3. Create Credentials.
  4. Provide OAuth Information
  5. Provide Redirect URI.
  6. Collect Application Client ID and Client Secret.

Please go to Google Cloud Platform from Here: Home – Google Cloud Platform

The first time accessing Google Cloud Console, you may see a popup asking you to select your country and agree to the Terms of Service. Go ahead and do so, then click on AGREE AND CONTINUE to move on to the next step.

Click on the App Registration Link

Create a new Project #

Upon accepting the Terms of Service we will be asked to select a Project. For totally new accounts accessing the Cloud Console, create a Project to get started with the Cloud Console. The option for creating a new project can be found in the top right corner with the NEW PROJECT button under Select a Project.

If you have directly landed on your Project Dashboard, please click on the CREATE PROJECT button from the top right corner of the Dashboard section as below screenshot:

At this step, we need to give a name for the project. Here, “FluentSMTP” is used as the name, and “No Organization” for the Location is used.

Enable Gmail API #

After creating the Project google will redirect us to the project dashboard. Now we need to Enable the GMAIL API for the project. We can find the option for enabling API & Services from APIs &Services > Enabled API & Services from the left sidebar as the below screenshot.

From the APIs & Services dashboard now we need to click on ENABLE APIS & SERVICES.

In the search bar search for “Gmail API“. This will list the GMAIL-related API services. We just need the Gmail API. Now click on the Gmail API and it will take us to the Gmail API page.

We could also directly search for the Gmail API once we created a project and redirected to the project overview as below:

Now we need to Enable the API by clicking on the ENABLE button below.

Create Credentials #

It takes a few seconds to enable the API and then redirect us to the GMAIL API Dashboard as below. This time we need to create the credentials for Fluent SMTP by clicking on CREATE CREDENTIALS button on the top right side of the page.

Credential Type #

For Credential Type, we need to select the USER DATA as the target accessible data and GMAIL API as the target GMAIL API that is selected by default.

Now for OAuth Consent Screen, Give a name for the App Name, an email address for the support email, and also an email for the developer’s contact information. The email addresses are used as the Email Address we will be used to deliver emails from WordPress using the Fluent SMTP plugin. Once the inputs are done click on SAVE AND CONTINUE.

Scopes #

For Fluent SMTP email delivery, we do not need to do anything for SCOPES options. You can still configure your own requirements if you need to.

OAuth Client ID #

Now for OAuth Client ID, we need to select the Application Type as Web Application and provide a name for the application.

We need to add an Authorized Redirect URI as below with the URL: https://fluentsmtp.com/gapi/

OAuth Credentials #

In the next step, we will be offered a Client ID as a credential. We can skip downloading or saving it as of now and click on DONE as we just finished creating the credentials for Fluent SMTP which we will collect later in this tutorial.

OAuth Publish App #

Now we need to publish the app we just created. Go to OAuth Consent Screen from the left sidebar and we will find our app FluentSMTP there. Now click on the PUBLISH APP right under the Testing section.

When asked to confirm, Please click on CONFIRM from Pust to Production popup window.

Collect Credentials #

Now we will collect the credentials we need. Go to Credentials from the left sidebar. Find the Project Name we created as “FluentSMTP” and click on the Edit icon from the right side as below.

Now the Client ID and Client Secret will be shown on the right side. We need to copy these 2 values and put them into Fluent SMTP Connection settings in the next steps.

Fluent SMTP Google Workspace Settings #

From Sender Settings, set the From Email as the Gmail or Google Workspace Email address. The “Set the return-path to match the From Email” means that the undeliverable emails will be returned to this exact email address if any bounces occur. Give a From Name as you wish. Forcing the sender’s name will force the name of the sender shown in the recipient’s email client.

Application Details #

Now we need to put the Client ID and Client Secret as we created and collected earlier in the previous steps. Now click on the “Authenticate with Google & Get Access Token”.

Generating Access token for Fluent SMTP #

This will redirect us to the Fluent SMTP server and in the process, Google will ask for the account that you want to allow access to your Gmail or Google Workspace account.

Optional Warning from Google #

Since this is a private application for just sending emails from your Google Cloud Project, Google will show an optional warning just as a reminder. Please click on Advanced and then Go to the fluentsmtp.com (unsafe) button as below to proceed to the next step.

Approve Fluent SMTP Project #

Then you will see an approval window to approve your project to access the user information from the Google Cloud Project. Please click on Continue to proceed to the next step.

Copy Generated Token #

This will take us to the Fluent SMTP Server and provide us with a generated Access Token. Click on Copy to copy the access token that we need in the next step.

Save Google Workspace Connection Settings #

Now we are in the last step to configure our Fluent SMTP with the Google Workspace or Gmail Email address. Input the copied access token from the earlier step in the Fluent SMTP connection setting and then Save the connection.

Access Keys Storage #

  • Store Access Keys in DB: By default, this is enabled and strongly recommended. This will keep the information in the Databases in Encrypted format.
  • Access Keys in Config File: This allows you to store the access keys in the following section inside the wp-config.php file by the following directives.

Simply copy the following snippet and replace the stars with the corresponding credential. Then simply paste it to the wp-config.php file of your WordPress installation

define( 'FLUENTMAIL_GMAIL_CLIENT_ID', '********************' );
define( 'FLUENTMAIL_GMAIL_CLIENT_SECRET', '********************' );

Optional Notification from Google #

An email with a notice indicating that the FluentSMTP app we created was granted access to the Gmail or Google Workspace Email will be sent to the email address. Don’t worry about this. It’s just a notification about the activity.

That’s all about Configuring Fluent SMTP with Gmail or Google Workspace Emails to send emails from the WordPress website. Additionally, it is recommended to Send a test email, Test Email Confirmation, and then Confirm Test Email Deliverability.

Leave a Reply

Your email address will not be published. Required fields are marked *