If you’re not an internet guru, the Gmail SMTP settings can be pretty confusing. What’s more, if you use WordPress, getting your website to deliver email correctly, without WordPress Support, with all of the different hosting environments can be a real trick. Using your web host for email is not entirely dependable and sometimes can even be impossible depending on a number of factors. Because of that, a lot of WordPress users and developers choose to use a method other than PHP mail to send email, which is what WordPress uses by default.
Before I dig into how to configure WordPress to work with Gmail’s SMTP server, you’ll need to know some basic information to get your Gmail configuration up and running. You can also use these settings in any standard email client if you’re trying to set up Gmail to work on your desktop or cell phone.
Here Are the Default Gmail SMTP Settings
- Gmail SMTP server address: smtp.gmail.com
- Gmail SMTP username: Your full Gmail address (e.g. email@example.com)
- Gmail SMTP password: Your Gmail password
- Gmail SMTP port (TLS): 587
- Gmail SMTP port (SSL): 465
- Gmail SMTP TLS/SSL required: yes
In this article, I won’t get into too many details about the various SMTP options available, but there are some popular services using the SMTP protocol besides Gmail. Some great examples are hosted email services like Mandrill, Sendgrid, or even something like Amazon Web Services SES. There are a whole bunch of other similar services that I could list here, but that’s not the purpose of this post.
This post is about properly setting up the Easy WP SMTP plugin, your Gmail SMTP settings, and navigating some pretty confusing security restrictions just to get an email from point A to point B. We spent several hours diagnosing and troubleshooting this email delivery issue for a customer and figured we’d save you the heartache by publishing a quick walk-through.
The reason we chose SMTP for this particular customer is because Gmail already has SMTP support built in, and the customer wanted a quick solution that wasn’t going to require any kind of recurring costs. Considering there are only a few users on the site, using Gmail to send their outgoing mail and form notifications was a good fit. For sites with higher volume of emails, or critical delivery, or where you want more flexibility, some of the other options I listed above are probably better suited for that.
Install the Easy WP SMTP plugin
The first thing you’re going to want to do to setup the Easy WP SMTP plugin is to install it on your site. Easy enough right?
Note: we did see some other SMTP plugins out there, and Easy WP SMTP seemed to be the most solid. There were some that were even storing unmasked passwords in plain text, which can be a huge issue for your email security. If you’re going to use SMTP to deliver email, this plugin is a good way to go.
Connecting Your Gmail Account
The next step is also pretty straight forward. You’re going to need your gmail username and password, and a few SMTP server settings which we’ll provide below.
Navigate to Settings –> Easy WP SMTP in your WordPress dashboard.
Configure the plugin exactly the way you see it in the screenshot above. Keep in mind that this is only controlling mail being sent out from WordPress, so your “from” email address and “from name should be what you want email recipients to see (most likely this is going to match whatever you use for your Gmail account). Your SMTP username is going to be your full Gmail address, and your SMTP password is going to be your Gmail password.
Save Changes and you’re ready to send email using SMTP! Well, at least that was the case until recently when Google made some security changes to Gmail which prevent remote logins unless you explicitly provide permission.
Gmail Wants to make Your Life Difficult (And Your Email More Secure).
When we configured Gmail SMTP settings for our customer, we only anticipated it taking a few minutes. That’s how it’s always been in the past. But after attempting multiple emails to our customer, none of them were getting through and we couldn’t figure out why.
Since we couldn’t get the emails to send, we tried the exact same setup on another server with an entirely different WordPress install, and my personal Gmail account. The emails still weren’t getting through.
I opened my email and the first thing I saw was a notification from Google saying that they had blocked a sign-in to my Gmail account. They knew that I was somewhere else in the world, so whoever or whatever was trying to access my account from Virginia wasn’t authorized.
But Google! I really want to authorize this server to access my email!
It turns out that in order for Google to authorize a third party server to access your account via SMTP now, you have to enable “Less Secure Apps” on your Gmail account. You can read a full explanation of the risks of that here, but essentially, any apps that aren’t using security protocols that Google deems mandatory will be blocked unless you enable the ability for less secure apps to access your Gmail account.
Now while I won’t recommend you allow less secure apps to access your Gmail account, it’s currently the only way I know of to allow WordPress to use your Gmail account to send outgoing mail. If you do choose to enable less secure app access, you can do that on this page in your Gmail account. There’s a screenshot below of where you’ll find the setting. Please don’t enable this access unless you fully understand what’s going on, and what the possible ramifications are.
It turns out that configuring your Gmail SMTP settings to send mail from WordPress isn’t quite as easy as it used to be. There are definitely better alternatives out there, but when you need a PHP mail alternative, and Gmail seems to be the best fit, this is the best way to get that done without suffering through too much head banging on your desk.
Do you tend to use the default mail mechanism in WordPress? Or some other method? Have you run into any other strange quirks setting up alternate email routing? Hit us up in the comments and we’ll all commiserate together 🙂