Google’s SMTP server is a free service that you can use to send emails from your custom domain, website, or web application. SMTP stands for Simple Mail Transfer Protocol. Basically, it’s an internet protocol for email transmission between servers. These days most emails are sent from an SMTP server. Anyone with a Gmail or Google Apps account can use Google’s free service, albeit it does have a daily sending limit.
In this article, we’ll have a look at how you can set up Google’s free SMTP server to send emails from a custom domain, a WordPress site, and a PHP server.
Why Use Google’s SMTP Server?
Having access to an external SMTP server has a couple of benefits. Most hosting providers (and sometimes ISPs, too) offer SMTP support, however this is not always the case. Even if you can send emails from your hosting account, you may bump into deliverability issues. For instance, emails sent from Google’s servers are less likely to be labeled as spam.
Besides, you have a secure (and searchable!) backup of your emails on Google’s servers. And, if you have more than one accounts you can manage all your emails from the same place, too. It can also be a godsend if you want to send emails from within your website or web application. WordPress even has plugins such as WP Mail SMTP by WPForms or Gmail SMTP for this purpose.
Some professional services such as newsletters, ebook download forms, and certain LinkedIn services also require users to have a custom email address. Meaning, they don’t accept email addresses ending in yahoo.com, gmail.com, etc. Having a custom email address enables you to access these services, too.
As I mentioned before, Google’s free service does have a daily sending limit—it is 100 emails per day. After you reach the limit, you won’t be able to send more emails for the next 24 hours. Most likely, this amount won’t be enough for a bigger company. However 3,000 free emails per month is still an excellent option for many smaller players.
Google’s SMTP Server Settings
You need to use the following settings to set up your custom domain, website, or web application with Google’s free SMTP server:
Outgoing Mail (SMTP) Server: smtp.gmail.com
Use Authentication: Yes
Use Secure Connection: Yes (TLS or SSL depending on your mail client or website plugin)
Username: your Gmail or Google Apps email address (e.g. email@example.com or firstname.lastname@example.org)
Password: your Gmail or Google Apps password
Port: 465 (for SSL) or 587 (for TLS)
Google recommends setting up an App password for the account as well to make sure that the authentication works fine. Here are the steps of generating an App password if you don’t have one yet. Before generating an App password, you need to enable two-step verification for your Google account, too. You can use your App password instead of your Gmail password to log into your account.
1. Send Emails from a Custom Domain
To send emails from a custom domain, for instance, from an email address such as email@example.com, you need to be the owner (or manager) of that domain.
Log in to your account at your domain registrar and look for the email forwarding settings (different DNS providers might use different menu labels, but usually, it’s just called “Email forwarding”). When you find them, set up an email forwarder that forwards emails from your custom domain to your Gmail account. For example, from firstname.lastname@example.org to email@example.com. This way, you will receive all incoming mails within your Gmail account.
Now, you need to set up your Gmail account to send outgoing mails using the custom domain. So, you will create the email inside your Gmail mailbox, but it will be sent from the custom email address. Go to your Gmail settings page by clicking the little gear icon in the top right corner of your mailbox and select the Settings dropdown menu. Then, navigate to the Accounts and Import tab:
Other Adjustments of Your Gmail Settings
These were the basic steps, however, if you want your custom email work perfectly with Google’s SMTP server, there are two other things you need to do.
First, if you want a copy of your outgoing emails inside your Gmail account’s Sent folder, you need to enable IMAP. IMAP stands for Internet Message Access Protocol. Email clients use this protocol to retrieve messages from a mail server.
On your Gmail settings page, find the Forwarding and POP/IMAP tab and navigate to the IMAP Access option. Here, choose the Enable IMAP option and hit the Save Changes button.
2. Send Emails from Your WordPress Site
WordPress allows you to send emails from their WordPress site. However, many website owners experience deliverability issues with the default wp_mail() function. For them, using an external SMTP server that sends the emails properly can be a lifesaver.
You can find a couple of SMTP plugins in the official WordPress repo. Here, I’ll show how you can use the WP Mail SMTP by WPForms plugin to configure your WordPress site with Google’s SMTP server.
3. Send Emails with PHPMailer
You can also use Google’s SMTP server to send emails from a PHP server. You can find many popular email sending libraries for PHP. Here, I’ll show you how to use one of the most popular ones called PHPMailer. You can install PHPMailer on your server via Composer or manually (see the detailed instructions in the docs).