Most people know Gmail for its clean interface and useful features, like search operators and add-ons. But you can also use Gmail for more.

The Gmail SMTP server lets you send emails from your Gmail account using other email clients, such as Outlook or Thunderbird. But more importantly, you can also use Gmail’s SMTP server to send emails from your WordPress site. For free!

This is a really great way to make your WordPress site’s emails more reliable without needing to spend money on a dedicated email sending service. Gmail lets you send up to 500 emails per day, which is more than enough for the vast majority of WordPress sites.

How to configure WordPress to send emails via Gmail SMTP server

Let’s get into how you can use the Gmail SMTP server to send your WordPress site’s transactional emails for free. This method works great and improves the reliability of your site’s emails over using the default PHP mail method.

To set this up, you need to create a Google Cloud project so that you can connect to the Gmail SMTP server via the API instead of just plugging in the SMTP details. This is a one-time setup process that takes few minutes.

In addition to creating a Google Cloud project, you also need the help of a WordPress SMTP plugin. You can use the Post SMTP Mailer/Email Log plugin, or WP Mail SMTP plugin which are both free and supports the Gmail API.

The basic process goes like this:

  1. Install the Post SMTP Mailer/Email Log plugin (you need to do this first to get the URLs to use in your Google app).
  2. Create a Google Cloud project. This guide walks you through each step.
  3. Add your Google app API keys to the Post SMTP Mailer/Email Log settings.
  4. Send a test email to make sure everything is working.

1. Install and configure Post SMTP Mailer/Email Log plugin

To get started, you need to install and activate the free Post SMTP Mailer/Email Log plugin from WordPress.org. This is what lets you configure your WordPress site to send emails via the Gmail API/SMTP server.

After activating the plugin, click the Start the Wizard button.

This brings you to a page showing the 3-Step Setup Wizard, where you must select the SMTP mailer, which in this case is Gmail API. After that, click Continue.

Choose your SMTP mailer — Gmail API
Choose your SMTP mailer — Gmail API.

The next step displays a form where you can set the “From Address” information, which includes the email address and the name that the emails is sent from.

There is also a section to configure your chosen SMTP mailer — in this case, the Gmail API. To connect the Gmail API with your WordPress site, you need a Client ID and Client Secret. These are obtained by creating a project in your Google Cloud Console.

Keep this page open, as you also need to provide the Authorized JavaScript Origins and Authorized Redirect URI details when setting up the app. This process essentially involves an exchange of information between the plugin and the Gmail API to establish a secure connection.

Configure mailer settings
Configure mailer settings.

2. Create your Google Cloud project

To get started, open a new tab and go to the Google Developers Console. Here, you’ll need to create a new project.

If this is your first time using Google Cloud Console, you’ll be prompted to select your country, agree to the Terms of Service, and click AGREE AND CONTINUE.

On the next screen, click on CREATE PROJECT (found on the right-hand side). If this is not your first time on the creating a project, click the dropdown next to the Google Cloud Console logo to open a dialog where you’ll find the option to create a new project.

Create Google Cloud Project
Create Google Cloud Project.

Once you click the NEW PROJECT button, a form appears where you can enter your project name and organization (if applicable).

Google Cloud Project Creation
Google Cloud Project Creation.

After filling out the information, click CREATE.

Once your project is created successfully, make sure you’re navigated to your project by checking that it appears in the field next to the Google Cloud logo. Then, navigate to APIs & Services > Library in the Google Cloud Console sidebar.

Scroll down to find the Gmail API under the Google Workspace section and click on it.

Gmail API under Google Workspace
Select Gmail API under Google Workspace.

On the Gmail API details page, click the ENABLE button.

Create credentials for the Gmail API

After enabling the Gmail API, you’ll be directed to the Gmail API Overview page. From there, click the CREATE CREDENTIALS button as shown in the screenshot below.

Create Credentials
Create Credentials.

On the next page, select Gmail API from the dropdown and choose User data under “What data will you be accessing?”. Then, click NEXT.

Gmail API Credentials
Gmail API Credentials.

Now, you’ll need to provide some basic information about your app:

  • App name
  • User support email (enter your Gmail address)
  • App logo (optional)
  • Developer contact information (enter your email address)

After entering this information, click SAVE AND CONTINUE.

In the next section for setting scopes, this step is optional. You can scroll down to the end of the section and click SAVE AND CONTINUE to move on.

Configure your OAuth credentials

For the next step, you’ll configure your credentials by providing information about your OAuth Client ID. In the Application type dropdown, select Web application. You can leave the Name field as default.

Scroll down and click + ADD URI to add the Authorized JavaScript origins and Authorized redirect URIs that were generated when configuring the Post SMTP settings. Then, click CREATE.

OAuth Client ID
OAuth Client ID.

Once your app is created, you’ll see your Client ID. Copy this ID and save it somewhere, or paste it directly into the Client ID field in the Post SMTP plugin configuration. After that, return to the Google Cloud project as you’ll also need the Client Secret.

Click DONE at the bottom of the page.

Retrieve your Client Secret

To get the Client Secret, navigate to the Credentials tab. Find the OAuth Client ID we just created and click the pencil icon to edit.

Client Secret Edit
Client Secret Edit.

The Client Secret information appears. Copy the Client Secret and either save it for later or paste it into the corresponding field in the Post SMTP plugin configuration.

Client Secret Information
Client Secret Information.

Add a test user

Once you’ve configured your OAuth consent screen and created your app, the next step is to add a test user. This is essential for testing the authorization process before going live with your integration.

To add a test user:

  1. Go to the OAuth consent screen section in your Google Cloud Console.
  2. Scroll down to the Test users section.
  3. Click the + ADD USERS button to open the user addition form.
  4. Enter the email addresses of the users you want to add. You can add multiple email addresses separated by commas. Make sure these users have Google accounts.
  5. Once you’ve added the email addresses, click SAVE.
add test user
Add test user.

Adding test users allows you to simulate the OAuth flow for specific accounts without needing to publish your app publicly. This way, you can ensure that everything works properly before releasing it to a wider audience.

3. Add Gmail Client IDs to Post SMTP Mailer/Email Log

To finish the setup, go back to the Post SMTP Mailer/Email Log settings in your WordPress dashboard and paste in the Client ID and Client secret from the previous step and click Connect to Gmail API.

Add Gmail API client IDs to WordPress
Add Gmail API client IDs to WordPress

Next, log in to your Google account. Make sure it’s the same account you used to create the web app in your Google Cloud project.

The following screen appears. Click Continue:

Google has not verified
Google has not verified.

Afterward, you’ll be prompted to give kinsta.cloud access to your Google account. Click Continue to authorize:

Give Kinsta cloud access
Give Kinsta cloud access to your Google account.

Once the connection is successful, you’ll be redirected back to the Post SMTP configuration page, where you’ll see this message: “The OAuth 2.0 authorization was successful. Ready to send e-mail.”

Finally, click the Save and Continue button to complete the process.

4. Send a test email

To make sure everything is working, Post SMTP Mailer/Email Log includes an option to send a test email. You can do this from the final step of the Post SMTP configuration page, or you can access the test email option from the main settings page.

How to send a test email via the Gmail API
How to send a test email via the Gmail API

You can enter the email that you want to send a test message to. Then, you should see a success message in the plugin’s settings:

The Success message for your test email
The Success message for your test email

And if you go to your email inbox, you should also see a test email:

The actual email that you should see in your inbox
The actual email that you should see in your inbox

If all goes well, you’re finished.

Your WordPress site now sends all of its emails using the Gmail SMTP server. You can make sure that this is happening by going to Post SMTP > Email Log. This lists all of the emails that your site sends (along with any errors if the plugin encounters problems):

How to view a log of the emails that your site sends
View a log of the emails that your site sends

Gmail SMTP server FAQs

Before wrapping things up, let’s answer some common questions about Gmail SMTP server.

What is the Gmail SMTP server address?

As we detailed above, the default server address is smtp.gmail.com. You can log in using your full Gmail email address and your Google password.

Can I use the Gmail SMTP server for sending email?

Yes! You can. If you’re using other email clients, such as Thunderbird or Outlook, you can use the Gmail SMTP server details to still send emails via your Gmail account.

However, remember that SMTP is just for sending email. If you want to also receive emails to your Gmail account in another email client, you’ll need to use POP3 or IMAP. You can find these settings by opening your Gmail settings and going to the Forwarding and POP/IMAP tab.

Can I use the Gmail SMTP server to send WordPress transactional emails?

Also yes! WordPress sends a lot of basic transactional emails for things like password resets, notifications, etc. and you can deliver all of those emails using the Gmail SMTP server.

With just a free Gmail account, you’ll be able to send up to 500 emails per day, which is significantly higher than the limits that other free SMTP servers apply.

If you have a paid Google Workspace account (formerly G Suite), Google raises your limit even higher and let you send up to 2,000 emails per day. You’ll also be able to send emails from your own custom domain name instead of your Gmail address. That is, you can send from [email protected] instead of [email protected]. To do so, you’ll also need to set up Google Workspace MX records to connect your Google Workspace account to your custom domain name.

Does the Gmail SMTP server still work with two-factor authentication?

Yes! You can use the SMTP server even if you’ve enabled two-factor authentication on your Google account. However, you need to generate an app password so that the app can still connect.

You can generate an app password by visiting this page while logged into your Google account.

However, if you want to use Gmail’s SMTP server to send your WordPress site’s emails, we don’t recommend using this approach. Instead, you should use the Gmail API method that we detailed in the tutorial above. This lets you send emails using Gmail’s API instead of just entering the SMTP server details, which also has the benefit of avoiding problems with two-factor authentication.

Summary

With the Gmail SMTP server, you can send emails using your Gmail account and Google’s servers.

One option here is to configure third-party email clients, such as Thunderbird or Outlook, to send emails via your Gmail account. The default Gmail SMTP settings are as follows:

Gmail SMTP server address smtp.gmail.com
Gmail SMTP name Your full name
Gmail SMTP username Your full Gmail address (e.g. [email protected])
Gmail SMTP password The password that you use to log in to Gmail
Gmail SMTP port (TLS) 587
Gmail SMTP port (SSL) 465

Another option is to use Gmail to send your WordPress site’s transactional emails. With a limit of 500 emails per day, Gmail’s free sending limits are significantly higher than other free SMTP services such as SendGrid or Mailgun.

However, if you’re doing this, you should send emails via the Gmail API instead of just using the SMTP server details.

While setting up an app to use the Gmail API does add some one-time complexity to the process, it’s worth the effort because it gives you a reliable and secure way to send your site’s emails.

Now that you’re all set, check out our list of Gmail add-ons to enhance your e-mail productivity.

Do you still have any questions about the Gmail SMTP server or how you can use it with WordPress? Ask us in the comments!

Matteo Duò Kinsta

Head of Content at Kinsta and Content Marketing Consultant for WordPress plugin developers. Connect with Matteo on Twitter.