Post

Use Gmail to send email from website

To set up Gmail as the mailer for sending emails from your WordPress site using the WP Mail SMTP plugin, follow these steps:

Step 1: Install and Activate WP Mail SMTP Plugin

1.Go to your WordPress dashboard. 1.Navigate to Plugins > Add New. 1.Search for “WP Mail SMTP”. 1.Click Install Now, then Activate.

Step 2: Configure WP Mail SMTP Settings

1.Go to WP Mail SMTP > Settings in your WordPress dashboard. 1.Under the Mailer tab, select “Google / Gmail”. 1.You will need to set up a Google app to get the required Client ID and Client Secret.

Step 3: Create a Google App

1.Visit the Google Cloud Console.

1.If you haven’t already, create a project: - Click Select a Project, then New Project. - Name your project and click Create.

1.Enable the Gmail API: - From the left menu, go to Library. - Search for “Gmail API” and click on it. - Click Enable.

1.Configure OAuth Consent Screen: - From the left menu, go to OAuth consent screen. - Choose External, then click Create. - Fill in the App Name, User Support Email, and other details. - Click Save and Continue until the end, and then Back to Dashboard.

1
2
3
4
1. Create Credentials:
   -  From the left menu, go to Credentials.
   -  Click on Create Credentials and choose OAuth 2.0 Client IDs.
   -  Choose Web application as the Application Type.

Add the https://connect.wpmailsmtp.com/google/ to redirect url under Credentials > OAuth 2.0 Client IDs > project-name > Authorized redirect URIs

Authenticate smtp

In website smtp settings click the big orange btn to authenticate smtp

send test email

Go to tools and send test email

Improve sending

add spf record to your domain

1
2
3
type: TXT
name: @
content: v=spf1 include:_spf.google.com ~all

If you have an existing spf record you will need to combine the two by adding the +include:_spf.google.com part to your existing record.

This post is licensed under CC BY 4.0 by the author.