Use Gmail to Reliably Send Email from Your WordPress Site

This is the easiest way to set up reliable emailing from your website

Setting up reliable email sending from a website can be kind of a hassle for web developers – at least it was for me.

For brochure sites, the web hosting company’s server email might be OK, but for any website requiring reliable email sending, it is prudent to use an SMTP email account to send email from your site.

Until I discovered this trick, I’d have to walk my clients through the painful process of authorizing their Gmail or Outlook email accounts with the site’s SMTP plugin. You had to be logged in while doing it, so I couldn’t do it for them.

In this article, I’ll show you an easy way to set up any Gmail account on your website, enabling it to send email reliably with minimal hassle.


The Harder (But More Secure) Way

The most secure way to set up your site to use Gmail to send email involves creating and configuring an app in your Google account and entering the resulting Client ID and Client Secret code in your SMTP plugin. The account may need to be a Google Workspace account (but I haven’t verified this).

See the instructions for how to set up your Gmail account with WP Mail SMTP. There are a LOT of steps!

If you have access to the Google account in question, then by all means, do it this way.

But if the client has two-factor and doesn’t want you in their Google account, you can’t do it for them. I have many non-technical clients who can’t handle these steps themselves.

The Easier Way

An easier way to get a Gmail account to work with your site is to utilize the Gmail SMTP server, generate an app password, and enter that into your SMTP plugin. Yes, this method is a tad less secure, so I wouldn’t use this for large enterprise sites. And it’s limited to sending 2000 messages per day. But for smaller clients, this is a great solution.

Creating Your Gmail App Password

The first thing you’ll have to do is generate a Google Mail app password (or have your client do this, but it’s much easier than generating a client ID and code). Here are the steps:

  1. Go to https://myaccount.google.com/
  2. Go to Security
  3. In the “Signing in to Google” section, click “App passwords” (you may need to verify your password):
Screenshot showing App passwords link

If you don’t see this option, it might be because:

  • 2-Step Verification is not set up for your account.
  • 2-Step Verification is only set up for security keys.
  • Your account is through work, school, or other organization.
  • You turned on Advanced Protection.

More info on this on Google’s page on signing in with app passwords.

Check these possibilities then return to the steps below when you see “App passwords” and can click it.

  1. When you see the popup, in the “Select App” pulldown, choose “Mail”.
  2. In the “Select device” pulldown, choose “Other (custom name)”
  3. Type in the name of your website followed by “email”.  For example: “mywebsite.com email”, or anything descriptive like that so you’ll know what this password is for and won’t accidentally delete it later.
  4. Click Generate and copy the password that appears.
App password settings in Google
App password settings in Google

That final step is important. You won’t ever get to see that password again in the Google admin, so remember to copy and paste it somewhere!

That was pretty much the hard part. Give that password to your developer, or I’ll show you how to enter it into a WordPress SMTP plugin below.


Setting Up Your SMTP Plugin

My two favorite WordPress SMTP WordPress plugins are WP Mail SMTP and Post SMTP Emailer. WP Mail SMTP has a much larger installed base. But Post SMTP Emailer is a newer plugin and includes email logging (a great feature!) in the free version. WP Mail SMTP only has it in the paid version.

WP Mail SMTP

To make this easy, I’ll just include a screenshot of the working settings for WP Mail SMTP:

Gmail settings for WP Mail SMTP using a Google app password
Gmail settings for WP Mail SMTP using a Google app password

Copy the settings from this screenshot, substituting your values where appropriate, then save!

Note the “From Email” should be the Gmail email address! Make sure “Force from email” is not checked!

Post SMTP Emailer

Here’s a screenshot showing the settings for the Post SMTP Emailer plugin:

Gmail settings for Post SMTP using a Google app password
Gmail settings for Post SMTP using a Google app password

Basically, copy all of these settings except for your “from” address and username/password. The “from” address should be the Gmail email address.


Conclusion

To finish up, be sure to test and make sure the emails are sending! Overall, I’ve found this to be the easiest way to set up reliable emailing on a website using any Gmail account.

I hope this was helpful. Let me know if it worked for you in the comments below!

Also, I wasn’t able to get this trick to work using Microsoft app passwords on Outlook mail. If you get that working, please let me know. – Brian

Featured image photo by Austin Distel on Unsplash.

2 thoughts on “Use Gmail to Reliably Send Email from Your WordPress Site”

  1. Hi, I was reading your article about using gmail for sending email on a WordPress website. I am wondering, when set up this way does a customer who receives an email see it is from the website email address or do they see the google email address?

    Reply
    • Hi Jared,

      You can specify the From address using the plugin settings. Usually you have to use the domain of the website. In any case, the recipient will not see the gmail email address.

      Best,
      Brain

      Reply

Leave a Comment



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

Shares
Share This