gmail smtp on wordpress

Securely Send WordPress Emails Using Gmail SMTP With WP Mail SMTP

Table of Contents

Want to send an email from your WordPress site, but you don’t want to use your web host’s email delivery service or an expensive SaaS solution? I’ve got an option for you that costs nothing.

WordPress does not allow you to send emails when you have configured a new blog. Instead, it asks you to set up an email account. That's fine, but not everyone wants to do that.

WordPress emails can only be delivered via SMTP if you have your own dedicated server or a co-located server with a full-time connection to the internet.

If you are short on money and would still like to send WordPress emails using Gmail SMTP, this article is for you.

Why Gmail SMTP?

Did you know you can use Gmail to send your WordPress emails? Yes, it’s true. There are a lot of reasons why people want this. Maybe you don’t like managing a complicated email service like Mailgun or Mandrill. Or maybe you just want to use the email service you already own. Whatever the reason, it does work and I’ll show you how!

Gmail is the world's favourite email application, boasting more than 1 billion users and counting. In addition to serving as a powerful email hub, though, it can also be used with WordPress to send automated emails from your blog or website.

And it's FREE!

But it has some limitations too. You cannot use it to send spam emails as 's system is smart to block your credentials from doing that.

If you have a small to medium-size business website with less than 1000 subscribers or mails to be sent in a month, then Gmail can be used efficiently.

WordPress Mail SMTP Gmail Setup

If you’re in need of a to help you send email through Gmail SMTP, then look no further.

Post SMTP is a simple PHP class that bridges the gap between your WordPress site and your Gmail account, helping you to avoid the monthly allotment restrictions of your typical web host.

Have you ever encountered an error like this:

WORDPRESS FORM SENDING ERROR

Server error. Form not sent. An error occurred.

This error is usually seen with Elementor forms. When the SMTP server is not configured correctly on the hosting server, this error is usually seen.

Shared hosting WordPress websites rarely see this kind of error with Elementor contact forms. Because they have configured the PHP to use a secured outgoing SMTP port.

If you have set up your server on a VPS or AWS or followed our AWS lightsail WordPress setup tutorial, then you will see this error with your Elementor forms. Other kinds of WordPress forms will show similar errors too.

But not to worry, we have written this detailed post to help you solve this error with ease. If you face any kind of problems in any setup, use the comment form below and let us know your questions.

Also if you are looking to get professional WordPress development services for yourself do not forget that we also offer these services.

To set up the WordPress Mail SMTP with Gmail, you need to have API access to Gmail API. It might sound complicated but we have tried to make it as simple as possible in this post.

Step 1: Install Post SMTP plugin.

Go to your WordPress Dashboard > Plugins > Add New.

Search for “Post SMTP“.

POST SMTP WORDPRESS PLUGIN INSTALL

Click the Install button and then the same button to Activate the plugin.

Step 2: Send a Test Email.

POST SMTP SEND TEST MAIL

Once the Post SMTP plugin is installed, go to its setting pages.

On the main Post SMTP settings page, you will see the option to Send a Test Email. Click on this link and see if you can send an email.

In most cases, it fails to send the email from your . It's Ok. We are just testing and checking if your server has any port configured to send the PHP mail.

When sending the test email fails, go to the Email Log section of the Post SMTP plugin.

POST SMTP EMAIL LOG

In the list, you will see the name “Postman SMTP Test“. When you hover above this link, below you will see the option “Session Transcript“. Click on this link and you will see a popup like this.

POST SMTP ERROR LOG

This shows that the server is configured to use 25 ports for outgoing mails. Next, we will fix this by using the Gmail SMTP.

Step 3: Setup Post SMTP plugin for Gmail

Now we will set up the Post SMTP plugin and get the required details for getting the API credentials from the Google Cloud Platform.

Start The Wizard For Setup

On the Post SMTP main settings page, there is a big button called “Start the Wizard”. Click on this button and you should see the below page.

POST SMTP IMPORT CONFIG

In the first step of Import Configuration, click the Next button.

Sender Details

In this step, fill out your Gmail id in the Email address section. In the Name field, fill out the name that you want to be displayed as your Email name.

POST SMTP SENDER DETAILS

Go to the next step by using the Next button.

Outgoing Mail Server Hostname

In this step, you do not need to do anything. Just wait a few minutes until the plugin finds the correct SMTP address of Gmail.

POST SMTP GMAIL SMTP

Press the Next button

Connectivity Test

In this step again you will be required to wait a few seconds until the script finds the correct ports available for the Gmail SMTP server.

POST SMTP CONNECTIVITY TEST WORDPRESS

Select the SMTP – gmail.com:587 as your selection. This port is the best for working for Gmail from PHP scripts. Let the Authentication part be OAuth 2.0. The password option sometimes gets errors as Gmail is very strict with web applications accessing its API using on username and passwords. Go to the next step using the Next button.

Authentication

POST SMTP AUTHENTICATION STEP

Note the two important details from this step. Authorized Javascript Origins and Authorized redirect URI. Keep This page open and open a new tab to start the Google Cloud Platform and get the Gmail API details.

Google Cloud Platform Setup For Gmail API

If you have followed the above steps and reached here then it is time to deal with the Google Cloud Platform. Open it in a new tab of your web browser.

Step 1: Sign In to the Google Cloud Platform with your Gmail ID

You can use the same Gmail ID that you want to use with your WordPress website to send emails. Once logged in you should see the Google Cloud Platform dashboard.

GOOGLE CLOUD DASHBOARD NEW

On the top of the Google Cloud Platform Dashboard, you will see the selection box called “Select A Project“. Click on this and you should see a new popup like this:

NEW PROJECT GOOGLE CLOUD

Click on the “NEW PROJECT” button in this popup.

Step 2: New Project Details

Now you should have reached the New Project setup page.

GOOGLE CLOUD PLATFORM NEW PROJECT

Fill up the Project Name and Location fields here.

No organization option in the Location field will work here and be accepted by the Google Cloud Platform. You do not need to create a new organization.

Step 3: APIs & Services

Once you fill in the new project details you will be redirected to the APIs & Services page as shown below.

ENABLE GOOGLE CLOUD API

On this page click the + ENABLE APIS AND SERVICES. You will be redirected to the APIs search page that looks like this:

SEARCH GMAIL API GOOGLE CLOUD

On this page search for Gmail.

You will get 2 results for Gmail search.

GOOGLE CLOUD GMAIL API

Select the Gmail API.

This will open the Gmail API description page. Click the ENABLE button here.

ENABLE GMAIL API GOOGLE CLOUD PLATFORM

Step 4: Gmail API Credentials

Once you enable the Gmail API on your Google Cloud Platform you will be redirected to the Overview page.

CREATE CREDENTIAL FOR GMAIL API

On the right side, you should see a button called CREATE CREDENTIALS button. This will open the Create credentials page.

In the Credential Type step select the Gmail API option.

GOOGLE CLOUD PLATFORM GMAIL API

And then select the option User data and press the Next button.

GMAIL API CREDENTIAL TYPE

In the Scopes step, you do not need to do anything as it is only optional. Just press the Next button here.

GMAIL API OAUTH SCOPE

On the next page, it will ask for OAuth consent screen details. Fill the details with your website name in the app name box. Put your Gmail id in the User support email that you want to be contacted for any errors or support from Google.

Put your personal email id in the Developer contact information field. Any email id will work here.

GMAIL API OAUTH SETUP

Press the SAVE AND CONTINUE button.

This will now open the OAuth Client ID section. A very important section.

GMAIL API CREDENTIALS SETUP

Select the Application Type as Web Application. Give any name in the Name field.

In the Authorized Javascript Origins press the ADD URI button and add the URL we saved from our WordPress Post SMTP setup page in another tab.

POST SMTP AUTHENTICATION STEP

Also, put the Authorized Redirect URl value.

GMAIL API AUTHORIZED ORIGINS

Press the Next button to get the Gmail API credentials created by Google Cloud Platform.

OAUTH GMAIL API CREDENTIALS SETUP

You will now see the Your Credentials section with your Gmail SMTP API. But here only the Client ID will be shown. To see the client secret key, press the credentials page link as shown above.

GOOGLE CLOUD GMAIL API CLIENT ID KEY

On the Credentials page on the right column, you should be seeing the Client ID and Client Secret details that need to be input in our Post SMTP setup page. Copy and paste accordingly.

Once you input the Client ID and Client Secret keys on your WordPress website with the Post SMTP setup page, press the Next button.

Step 5: Notifications

POST SMTP NOTIFICATION STEP

This step is optional and you can just press the Next button here.

Step 6: Finish

POSTMAN LAST STEP FINISH

We are almost to the end of the setup. This page just gives you the final notice.

Press the Finish button on this page. This is just the plugin setup finishing, we have a few more steps ahead!

Step 7: Grant permission with Google.

Once you press the Finish button from the above step you will be redirected to the main Post SMTP page where you can see the Grant permission with Google link.

GRANT PERMISSION WITH GOOGLE LINK

Click on this link and you will be redirected to the Google sign-in page. Select your account here and press the next button.

You will see an Authorization Error page like this:

GMAIL API AUTHORIZATION ERROR

This means that we have one more step to complete on the Google Cloud Platform API page. Go back to your Google Cloud Platform page and open the OAuth consent screen.

You will see that the Publishing Status is pending and the button PUBLISH APP is not active. Click on this button and make it active. You will see a pop up like this:

CONFIRM APP PUBLISH

Press the CONFIRM button here.

You will see that Verification Status now showing as Verification not required. This is good news because you do not have to go through the verification steps of Google just to use the Gmail API. Believe me it's a very lengthy process!

GMAIL API SETUP COMPLETE ON GOOGLE CLOUD PLATFORM

You should now see the Gmail API overview page. The Activation Status should be Enabled here.

Now go back to your WordPress Post SMTP settings page where we started at the beginning of this step.

Click on the Grant permission with Google link again and follow the same process. The error we saw at the beginning of this step should have been gone now and you should see a warning page like this. (If you still see the Authorization Error or Request Error page here, just wait a few minutes until Google Cloud Platform updates its API settings. This will take from a few minutes up to 30 minutes.)

GOOGLE VERIFY APP WARNING PAGE

Click on the Show Advanced link and then click the Go to [yourwebsiteurl] (unsafe) link.

This should redirect you to the permissions approval page.

GMAIL APPROVE API ACCESS

Click on the Continue button here and you should be redirected back to your WordPress dashboard of Post SMTP main settings page.

POSTMAN IS CONFIGURED

On this page, you should see the Postman is configured notice in green colour. This is good news and we have successfully finished setting up the Gmail SMTP integration with our WordPress website.

Now you can send your WordPress website emails using your Gmail account with ease and free.

Final Words

This is a long setup process for using the Gmail SMTP API of Google. But it's completely worth it.

You get to use Gmail to send and receive emails for your website. And we all know how easy it is to use Gmail. Plus it's a free email service.

Follow this tutorial step by step and set up Gmail for outgoing emails of your WordPress website.

Show us some love by subscribing to our newsletter and commenting below to keep us motivated to write more such tutorials.

Share This Article:
Facebook
Twitter
LinkedIn
Pinterest
WhatsApp
Email
Reddit
Related Articles:
image size reduce online
Facebook
Free Image Size Reduction Trick

Without Any Plugin Did you know that a normal website gets most of its weight from the images used in it? It is true. The majority of website size is mostly because of the images used in its pages. Optimizing images without losing quality is a difficult task for average

Read More »
free wordpress hosting
Plugins
Host Your WordPress Website For Free Forever

Hosting a WordPress website can be an expensive thing if not done properly. It can go from just a few dollars to thousands of dollars a month. Finding WordPress hosting can be a difficult task. If you own a small blog or website that you do not update often then

Read More »
free high quality backlinks
Backlinks
Get Free High Quality Backlinks The Creative Way

A backlink in the SEO world is a link from a post or a page on one website to another. If a website is linking to your content, it means you got a backlink. These backlinks are also called “inbound links”. Sometimes they are also called “incoming links”. Carrying a

Read More »
Core Web Vitals SEO
Search Engine Optimization (SEO)
Core Web Vitals SEO In 2021

Any website’s long-term success hinges on its ability to provide a high-quality user experience. Core Web Vitals SEO can help you measure the experience of your site and find possibilities for improvement, whether you’re a business owner, marketer, or developer. Google’s Web Vitals program aims to provide unified guidelines for

Read More »
wordpress website migrate to lightsail
Linux
Migrating WordPress Website To Lightsail On AWS – Part 1

Are you running your WordPress website on shared hosting or VPS that is not performing well? Want to move your WordPress website to a better and reliable hosting provider? There are many good hosting solutions providers on the internet. Our favorite is Amazon Web Services also popularly known as AWS.

Read More »
wordpress learning management system
WordPress
No, you’re not really making an LMS

I had a client call today with someone who was attempting to substitute several systems for a client. They wanted to use WooCommerce, but they needed to use features from at least three different platforms: Kajabi, Mighty Networks, and Shopify. It wasn’t a long conversation but, as we dug deeper

Read More »
Chat With Our SEO community members On discord
Discord SEO Community Chat
  • nkap avatar nkap <@211319858258771968> hey, would you be able to share the website that you want guest posts on? I’m in touch with a few fintech businesses and can ask them whether they’d be interested in putting a post on your site.
  • ddev66 avatar ddev66 <@211319858258771968> it sure will work. Make sure to write that it’s free to post as guests. A lot of websites do not mention this and writers usually think it’s paid opportunity only.

    Keep us updated of how well this goes for your website.
  • soutaraku avatar soutaraku Thank you so much for the detailed guide. I'll see if I can put up the Guest Post page to start with! I hope my email gets bombarded in a good way haha
  • ddev66 avatar ddev66 You should start putting up a page called Guest Posting on your other website where you put articles, etc.. and put all the requirements there which you are looking for in the guest posts. Make sure to leave your email as well for easier contacts.

    Build up some links to this page. Because most of the writers are looking to write for high metrics website that have good DA, TF, etc...

    Once you have a page setup it will help you get attention from people who are searching on Google.

    Next you can start sending the URL of this page to people whom you think might be interested to write for your service on social networks like twitter, linkedin, etc.

    Also list this page URL on websites that have posts like free guest posts list in SaaS, free guest posts list in "your niche", etc. Something like this: https://underwp.com/the-best-free-guest-posting-websites-list-in-2022-over-3000/

    These will get you enough traction to attract guest posts from various contributors over the time. Your email will be bombarded with emails following the above tips.
  • soutaraku avatar soutaraku I can translate guest post to Japanese and put it on our website to share stories from overseas. I thought it would be interesting for our readers and a good way for link building.
  • soutaraku avatar soutaraku It's not titled as contribute/guest posts page, but there's a website we put interview articles and such. We surely can put guest posts on that website.
  • ddev66 avatar ddev66 <@211319858258771968> does your website have contribute/guest posts page?
  • soutaraku avatar soutaraku Hi guys! I'm a Japanese SEO specialist/ content editor working for a fintech company, and looking for someone to put guest posts on our website (preferably about fintech or SaaS market). Are there any good place to look for people willing to guest post?

    In Japan, not many people write guest posts, so I'm kinda lost. Twitter trick is only guiding light to me, <@838326478924021760>. Thanks for sharing.
  • z. avatar z. trying it out right now
  • nkap avatar nkap Great idea! Will definitely try it out. Thanks mate.
  • ddev66 avatar ddev66 A good trick to get guest posts for your website. <@968643757010481232> <@755307075625549854>
  • Büşra avatar Büşra Thank you very much. I'll try 😊
  • nkap avatar nkap Yeah me too!!
  • naaz avatar naaz <@755307075625549854> Thank you for the detailed answer. Hope <@341197404302737408> finds the right solution for this.
  • nkap avatar nkap <@341197404302737408> Just these:

    You can try 3 things: (I suggest you try the 3rd option first)

    1. If there are any links in your coverage report that’s actually not from your domain/property, I’d recommend you use the Search Console’s removal tool to remove these from your property.

    2. If you’re using any page builders like elementor etc make sure you turn off search engine indexing for things like templates. You can find this in Yoast SEO settings. With this setting your templates and unnecessary pages won’t be indexed. Are you using elementor by any chance?

    3. It’s also possible that your site has been hacked. If random URLs are appearing in analytics and search console the first thing that you should do is check your .htaccess file to see if someone has put any rewrite rules.
  • ddev66 avatar ddev66 <@755307075625549854> got any views on this?
  • ddev66 avatar ddev66 did you change your permalinks sometime back in last few months?
  • naaz avatar naaz <@838326478924021760> bringing to your attention on this.
  • Büşra avatar Büşra hello guys! I need to help about SEO optimation. I'm using wordpress Yoast. I saw dummy link like as ``` https://myURL.com/cuisine/35/17498``` I haven't these in page. Btw ı'm using google search console. Why may be this? Is anyone has idea about that?
  • ankit662003 avatar ankit662003 does anyone know how to create seo silos?
  • ankit662003 avatar ankit662003 hi
  • ddev66 avatar ddev66 Just know that we are all here to help each other
  • ddev66 avatar ddev66 No worries mate.
  • Alex25 avatar Alex25 The thing is idk what to ask .
    I'm just stuck
  • ddev66 avatar ddev66 Drop your queries here
  • ddev66 avatar ddev66 Surely <@555915490791391232>
  • Alex25 avatar Alex25 Hello guys ,
    I'm a begginer at Marketing and i'm really stuck on my project if you guys can help me with it i'll be soo greatful .
  • ddev66 avatar ddev66 Discuss your seo related questions here
  • Alex25 avatar Alex25 Hello everyone
  • ddev66 avatar ddev66 Hello everyone! Here we will be sharing all the SEO related information and threads.

One Response

  1. A very well written detailed guide on the SMTP problems of WordPress. Kudos.
    I followed all the steps you wrote and it helped me fixed the email SMTP problems that I faced whenver I install a WordPress website for my clients. I will keep this as a reference guide for all my future install of WordPress websites. Also easy to follow.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: