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 Hard Way
Before talking about the “easy” way, I want to touch on the “hard” way of doing this. Basically, that involves creating and configuring an app in your Google account and entering the resulting Client ID and Client Secret code in your SMTP plugin. As far as I can tell, it requires a Google Workspace (formerly GSuite) account (because regular Gmail accounts don’t allow Internal User Types). I never could get it to work with a normal Gmail account.
If you are interested in the gory details, see the instructions for how to set up your Gmail account with WP Mail SMTP. There are literally dozens of steps to this process. It’s not something I would want to guide my clients through!
The Easy Way
The easiest way to get your Gmail account (any Gmail account, not just Workspace accounts) 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). Here are the steps:
- Go to https://myaccount.google.com/
- Go to Security
- In the “Signing in to Google” section, click “App passwords” (you may need to verify your password)
- When you see the popup, in the “Select App” pulldown, choose “Mail”.
- In the “Select device” pulldown, choose “Other (custom name)”
- 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.
- Click Generate and copy the password that appears.
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:
At the top, enter the “from” email address ending with your site’s domain name. This is important. If your site is at “example.com”, and you enter a from email address like “firstname.lastname@example.org”, it won’t work. You have to use “[something]@yourdomain.com” if your site is at yourdomain.com, even if that email address doesn’t exist in reality.
After that, just copy the settings from this screenshot. Then, paste your Google app password in the last field and save!
Post SMTP Emailer
Here’s a screenshot showing the settings for the Post SMTP Emailer plugin:
Basically, copy all of these settings except for your “from” address and username/password. Remember to use your site’s domain name in the from email, as I explained above, or it won’t work.
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!