Last Updated 24 Jul 2024
|

How To Set Up Gmail SMTP in WordPress To Send Emails – 2 Ways

Quick Summary ↪ This article shows how to leverage Gmail's SMTP server to send emails for free from your WordPress website. Read on to learn two primary methods: Using a custom domain or integrating a WordPress plugin with a Google App, including the App ID.

How to use Gmail SMTP server

When it comes to email service providers, a few big names that come to mind are Yahoo!, Outlook, iCloud, AOL and Yandex. Any idea who has the most significant market share?

We guess it’s pretty apparent, especially considering we conveniently missed mentioning it in the list above. Yes, Gmail it is!

Gmail currently has over 1.8 billion users worldwide and a market share of 43%. Yahoo! and Outlook trai in second and third place with a market share of 26% and 6% respectively. (Source: TechJury)

Gmail is convenient and reliable. You get the feeling that you are in safe hands with a well-known name. After all, it’s backed by Google.

How would you like to use the Gmail SMTP server to send emails for free?

Using the Gmail SMTP server, you can easily send emails from your WordPress website.

You don’t need to spend money on third-party email services, you don’t need to rely on WordPress’ internal email and you get to send up to 500 emails per day for free.

In this article, we’ll cover all you need to know about the Gmail SMTP server and how to send emails from WordPress using Gmail.

What Is SMTP?

An SMTP (Simple Mail Transfer Protocol) server is used to send, receive, and relay outgoing emails between senders and receivers.

Typically, an SMTP server will have an address set by the mail client you are using. The general format is smtp.clientaddress.com.

For instance, if you were to use Gmail’s SMTP server, the address would be smtp.gmail.com. You can locate the SMTP server address under the account settings of your email client.

When you send an email, it will be forwarded from your email client to the SMTP server. The server will then relay the mail to the recipient’s email server.

There are two main types of SMTP servers — internal and external.

When you sign up with a hosting service, you get to use their internal SMTP server to send emails. You can also use the Gmail external SMTP server to send email.

The choice is entirely up to you.

To help you decide, here are some benefits of using the Gmail SMTP server:

  • It is free. All you need to do is create a Gmail account and you’re good to go
  • A user-friendly interface that all Gmail users are accustomed to
  • Reliable service with a decent uptime compared to other SMTP services
  • Gmail’s SMTP servers are considered to be secure
  • You can easily set up and start sending emails for free

While the good outweighs the not so good, there are a few reasons why you may think twice before using the Gmail SMTP server:

  • There is a daily limit of 500 emails
  • If you try blasting emails (mass mailers), Google will temporarily disable your account
  • Gmail is a simple mail transfer protocol and nothing fancy. You can only send emails in plain text

Now that we know what an SMTP is and the benefits of using the Gmail SMTP server, let’s show you how to start using one.

How to Locate the Gmail SMTP Server

As mentioned earlier, the default Gmail SMTP server address is smtp.gmail.com.

You can use the Gmail SMTP server by incorporating the following details:

  • Server address: smtp.gmail.com
  • Name: Your full name
  • Username: Your Gmail address (e.g., [email protected])
  • Password: Your Gmail password
  • SMTP port (TLS): 587 (TLS is the Transport Layer Security which encrypts email data)
  • SMTP port (SSL): 465 (SSL is the Secure Sockets Layer that authenticates and encrypts links between networks)

How to Use the Gmail SMTP Server to Send Emails

We’ll start with the easy bit. Not that the second one is any more difficult!

You have two main options if you want to use Gmail to send emails from WordPress. You can use a custom email address you set up yourself or use a WordPress plugin.

We’ll show you how to set up both.

Using a Custom Domain

Do you have a custom email address? A custom address that you created after purchasing a domain? Want to send emails using the Gmail SMTP server?

A custom address is an email address that reflects your domain. For example, let’s say you bought the domain mybusiness.com. Your web hosting plan allows you to create a custom email address of your choice, such as [email protected].

A custom domain can be anything you like but you get the idea…

Connecting to the Gmail SMTP server to send emails using a custom domain is pretty straightforward.

We are assuming that you have a custom email address and a Gmail account already.

Before we proceed, do you have the 2-factor authentication turned on for your Gmail account? If so, you will need to get yourself a Google App Password.

An app password is a 16-digit passcode that gives less secure apps or devices permission to access your Google Account.

App passwords aren’t recommended unless you have the 2-factor authentication turned on.

iOS 11 doesn’t require app passwords at all. Instead, you can use the ‘Sign in with Google’ option. It’s only when the app doesn’t offer the ‘Sign in with Google’ option that you can either use app passwords or switch to a more secure app or device.

Once you’ve got your password, let’s move on to the next steps.

Here are simple 2 steps set up to use the Gmail SMTP Server to Send Emails

  • Step 1: Log in to Gmail
  • Step 2: Add an email account

Step 1: Log in to Gmail

After you’ve logged into Gmail, navigate to your account Settings by clicking on the gear icon in the top right-hand corner.

Then click on the Accounts tab.

Gmail account settings

Step 2: Add email account

We’ll now add the custom email account. Click on Add another email address.

Enter the name and email address. In our example, the email address would be [email protected]. You can set the name to anything you like.

add email account

Click on Next Step once you are done.

gmail SMTP setting

Go ahead and enter the details, such as the Gmail SMTP server, your Gmail username and the app password you just created.

Click on Add Account once done.

You will receive a verification email to your custom email address. Click the confirmation link.

That’s it! You’ve just linked the custom email address with the Gmail SMTP server. You can now send emails from your custom ([email protected]) email address through Gmail!

Using a WordPress Plugin

Want to send your WordPress emails using Gmail SMTP server for free?

Compared to the default PHP mail method, sending emails from your WordPress site using a Gmail SMTP server is far more reliable.

To set up Gmail SMTP in WordPress using a plugin, we will follow a 3-step process:

  1. Step 1: Install the WordPress WP Mail SMTP plugin
  2. Step 2: Create a Google App
  3. Step 3: Include the App ID into the WordPress plugin

Step 1: Install the WordPress Plugin

There are several SMTP WordPress plugins that you can use. We’ll use the WP Mail SMTP plugin. It’s a popular plugin and used in well over 2 Million websites.

WP mail SMTP by WPForms

Go ahead and install the plugin.

Once the WordPress plugin is activated, head over to WP Mail SMTP > Settings and scroll down to the Mailer section.

WP mail SMTP mailer

Among the various mailing options, select Gmail.

On selecting Gmail, you’ll notice a set of new fields that come up.

Mailer setting

You will need to include the Client ID and the Client Secret details. Also, keep note of the Authorized redirect URL. This will be required a little later in the setup process.

How do we get these? By creating a Google App.

Step 2: Create a Google App

The Google App is required to send emails securely from your WordPress site using the Gmail API.

While this step takes a bit of time, it involves a set of easy-to-follow instructions to create an app. However, it’s a one-time thing, and once it’s completed, you can sit back and rest assured that your emails are being delivered seamlessly.

First, we will need to create a new project.

For this, head over to the Google Developers Console.

Google cloud platform

Now click on Create Project.

create new project

Name your project and leave the location field as it is. Click Create once you are done.

You’ll be directed to the dashboard, where you’ll see your new project.

Google app dashboard

We now need to enable Gmail API, which can be done by clicking on ‘+ Enable Apps And Services.’

You will be directed to the API library.

Google cloud api library

Search for Gmail API in the search field provided.

search for gmail API

Click on the Gmail API option.

On the next screen, click on the Enable button.

Enable Gmail API

Once you’ve enabled the Gmail API, you will be directed to your dashboard.

Gmail API dashboard

Click on Create Credentials to start using the Gmail API.

Carefully fill out the details required in the following screens.

Gmail API credential type

Under Credential Type, select Gmail API from the dropdown list under which API you are using. Then select the User data option under what data you want to access.

Click Next when you are done.

The next screen, i.e., the OAuth Consent Screen, is pretty straightforward.

Gmail API OAuth consent screen

Name your App, and add the support and developer email address. You could upload a logo too, which will help users recognize your app. You could also choose to leave this for now.

Click Save And Continue.

You’ll need to keep note of a few essential elements in the OAuth Client ID tab.

Gmail API OAuth client ID

First, from the list of options under Application type, select Web application. Name your client ID. This is for internal use only.

You’ll need to add your website URL under Authorized Javascript origins. This will be included under the consent screen as an authorized domain.

This is important when we connect our website to the Gmail API a little later.

Notice the field for Authorized redirect URLs?

If you recall, when we installed our WordPress plugin, we left our setup at a point where the client ID and secret were required. In the same window, the URL for the authorized redirect was also mentioned.

Head back to your WordPress dashboard, and copy the URL, and include it here.

Save And Continue to the next step.

You will notice the credentials in the final step.

Gmail API credential final setting

While you can copy the client ID, we’ll do that in a while. Click Done.

You will now be redirected to the credentials page for this app.

Gmail API client ID

Here you will be able to copy the client ID and the client secret.

Step 3: Include the App ID into the WordPress Plugin

Now that you have successfully created the Gmail App, we need to connect it to our WordPress website.

Head back to the WordPress dashboard and over to the WP Mail SMTP settings page.

WP mail SMTP settings

Key in the Client ID and the Client Secret. Then click on Save Settings.

Once the settings have taken effect, you’ll notice a ‘Allow plugin to send emails using your Google Account’ button.

WP mail SMTP settings 2

Click the button and you’ll be directed to the Google sign-in page.

Select the Gmail account used while creating the Gmail App.

WP mail SMTP settings 3

Once the connection has been made, you’ll notice the button has changed to ‘Remove Connection.’ The email address used to connect to your account will also be displayed.

Click on Save Settings when it’s all complete.

Wouldn’t you like to test if everything works? Sure we do!

Head over to WP Mail SMTP > Tools.

You can send a test mail to verify if your connections are all good and if the emails from your WordPress site are being sent using the Gmail SMTP server.

WP mail SMTP test email

Enter the email address and then click Send Email.

WP mail SMTP test email 2

You should get a confirmation message stating that the test HTML email was sent successfully.

To double-check, go ahead and check your email.

You should see the following message.

Test email send by WP mail SMTP

That’s it! You can now use the Gmail SMTP server to send emails from your WordPress site.

Gmail SMTP Server FAQs

We’ve created this post based on frequently asked questions by users. The following two questions are also popular, so let’s answer those too.

Can Gmail SMTP Server be used to Send WordPress Transactional Emails?

Yes, it can! The Gmail SMTP server can be used to send WordPress transactional emails. As mentioned earlier, WordPress sends a lot of notifications and transactional emails such as password reset, new blog comments, new users following your blog, so on and so forth. All these emails can be sent using the Gmail SMTP server.

Can the Gmail SMTP Server Work With Two-Factor Authentication?

Yes, you can use the Gmail SMTP server even if the two-factor authentication is enabled on your Google account. However, you will need an app password to connect with your account. This step is pretty straightforward and has been explained in detail above.

If two-factor authentication is enabled and you want to send emails from your WordPress site, you should use the Gmail API method.

Do You Use Gmail SMTP Server to Send Emails?

When it comes to email service providers, Gmail has the maximum market share. Coming from a company like Google, there’s a certain trust and reliability that comes with the brand.

So, when you have a server that is as secure and reliable as Gmail, why not use its SMTP server to send emails, and for free?

We’ve walked you through the entire process of setting up and using the Gmail SMTP server.

We hope you can follow along and send out your emails using this method. Are the steps mentioned here helpful? Do let us know in the comments!

Article by
Pratik Chaskar
LinkedInTwitter

Pratik Chaskar holds the pivotal role of CTO at Brainstorm Force, serving as the backbone of the company. Renowned for his organizational skills, strategic thinking, problem-solving attitude, and expertise in leading and executing plans, Pratik plays a crucial role in the BSF’s technological landscape.

Disclosure: This blog may contain affiliate links. If you make a purchase through one of these links, we may receive a small commission. Read disclosure. Rest assured that we only recommend products that we have personally used and believe will add value to our readers. Thanks for your support!

1 comment
  1. Naimsh Randeri Profile Pic
    Naimsh Randeri

    Hi team,

    I am WPAstra’s client

    This is very good artical. I understand SMTP and how to configure at Google Cloud console.

    I have question, what is best practice to configure for my website client. I have client who has business email from Google.

    Do I need to access Google Cloud Console using their business email? Because I can’t use my personal Gmail or Business email to configure their business email with SMTP for contact Us Page.

    The problem is if the client change the password after configuration, the fomr stops working.

    Can you please suggest any ideal way to perform this steps for my business client’s email

    Thanks
    Naimish

Leave a Comment

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

Join 1,653,898+ Happy Site Owners Using Astra

Whether you are a beginner, small business owner, or professional web developer, Astra provides all the tools you need to easily build your beautiful WordPress website.

Download is Just A Click Away!

Membership Retention Checklist Download

REWIND

YEAR IN REVIEW

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form
Scroll to Top