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 or Microsoft 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 or Microsoft 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. This method is limited to sending 2000 messages per day. But for smaller clients, this is a great solution.
Generating Your Microsoft App Password
Here’s how to get your app password with Microsoft 365. Note that the account will need to have two-factor authentication enabled for this to work.
Once you have it, set up your SMTP email plugin using that password along with these settings:
- SMTP server: smtp.office365.com
- Port Number: 587
- Encryption method: TLS
Generating Your Gmail App Password
Here are the steps to generate a Google Mail app password:
- 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):
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.
- 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.
This is Google’s page on how to set up apps to use Gmail. I’ve summarized the settings below.
WP Mail SMTP
To make this easy, I’ll just include a screenshot of the working settings for WP Mail SMTP:
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:
Basically, copy all of these settings except for your “from” address and username/password. The “from” address should be the Gmail email address.
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!