// Tutorial //

How To Use Google's SMTP Server

Published on July 16, 2013 · Updated on October 5, 2020
Default avatar
English
How To Use Google's SMTP Server

The author selected the COVID-19 Relief Fund to receive a donation as part of the Write for DOnations program.

Introduction

A little-known feature of Gmail and Google Apps email is Google’s portable SMTP server. Instead of having to manage your own outgoing mail server on your DigitalOcean Droplet or Kubernetes Cluster, you can configure Google’s SMTP server settings with whatever script or program you wish to send email. All you need is either (i) a free Gmail account, or (ii) a paid G Suite account.

Note: As of June 22, 2022, DigitalOcean is blocking SMTP for all new accounts. As a part of this new policy, we have partnered with SendGrid so our customers can still send emails with ease. You can learn more about this partnership and get started using SendGrid by checking out our DigitalOcean’s SendGrid Marketplace App.

Benefits

You have the option of having Google store and index the emails you send via its SMTP server, so all your sent emails will be searchable and backed-up on Google’s servers. If you elect to use your Gmail or G Suite account for your incoming email as well, you’ll have all your email in one convenient place. Also, since Google’s SMTP server does not use port 25, you`ll reduce the probability that an ISP might block your email or flag it as spam.

Settings

Google’s SMTP server requires authentication, so here’s how to set it up in your mail client or application:

Note: Before you begin, consider investigating your mail client or application’s security rating, according to Google. If you are using a program that Google does not consider secure, your usage will be blocked unless you enable less-secure applications (a security setting that Google does not recommend) or generate an application-specific App Password. For more security information, see this link to determine the best approach for your mail client or application.

  1. SMTP server (i.e., outgoing mail server): [smtp.gmail.com (http://smtp.gmail.com)
  2. SMTP username: Your full Gmail or G Suite email address (e.g., example@gmail.com or example@your_domain)
  3. SMTP password: Your Gmail or G Suite email password
  4. SMTP port: 465
  5. SMTP TLS/SSL required: yes

In order for Google to automatically copy your sent emails to the sent folder, you must also verify that IMAP access is enabled for your account.

To do so, go to the Gmail settings and click on the Forwarding and POP/IMAP tab. Scroll down to the IMAP Access section and make sure that IMAP access is enabled for your account.

Note: Google will automatically rewrite the From line of any email you send via its SMTP server to the default email address associated with the account if the one used is not on the Send mail as addresses list in Gmail or G Suite settings. You can verify the list by going to the Accounts and Import tab on the settings screen.

You need to be aware of this nuance because it affects the presentation of your email, from the point of view of the recipient, and it may also affect the Reply To setting of some programs.

Sending Limits

Google limits the amount of mail a user can send through its portable SMTP server. This limit restricts the number of messages sent per day to 99 emails; the restriction is automatically removed 24 hours after you hit the limit.

Conclusion

You now have the option of using Google’s SMTP Server. If this lightweight option is not sufficient, you can consider installing and configuring postfix as a send-only SMTP server.


Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in our Questions & Answers section, find tutorials and tools that will help you grow as a developer and scale your project or business, and subscribe to topics of interest.

Sign up
About the authors
Default avatar
Developer and author at DigitalOcean.

Default avatar
Developer and author at DigitalOcean.

Default avatar
Developer and author at DigitalOcean.

Still looking for an answer?

Was this helpful?
10 Comments

It seems this no longer works, or at least I haven’t been able to get it to. Some comments elsewhere suggest that Gmail SMTP is now usable only by paid G-Suite subscribers. Could someone confirm this is actually so? If that’s the case, are there any good free alternatives?

Edit: After adding ssl:// for opencart users. You must also visit this link:

https://accounts.google.com/b/0/DisplayUnlockCaptcha

Make sure you are signed into the Google account you’re using for opencart SMTP.

Once you authenticate you must go to your opencart store and register a new account so that your store is authenticated with your google account. (This must be done within 10 minutes of clicking the above link.) You should get a successful account creation message and a new email in the email you used for the new account.

@jntslvdrt

If anyone is trying to setup Gmail SMTP for opencart, users will get this error when trying to create an account and other actions where emails are automatically sent:

“Notice: Error: EHLO not accepted from server! in /var/www/system/library/mail.php on line 200”

The solution to the problem is to add ssl:// before smtp.gmail.com in the hostname field for opencart mail settings. Since there is no built in option to specify ssl you have to just add that little bit before. After that, all should work perfectly.

I’m also confused, is there a recommend app to use for this process? I just want to be able to send and receive emails from a “support@mydomain.com”. What is the quickest way to do this?

Finally solved by using this link: https://www.google.com/accounts/DisplayUnlockCaptcha

And then running the script. Mysterious are the Google authentication mechanisms…

Do you know if the 99 mails limit is also applicable to google apps accounts? There is some alternative DO smtp service to the google one?

Could indicate managers emails to use with Droplets. I know: AfterLogic webmail Roundcube. Does anyone know more?

For Google Workspace users

“Limits per user The maximum number of messages a user can send in a 24-hour period is 10,000. However, this can vary, depending on the number of user licenses in your Google Workspace account. A registered Google Workspace user can’t relay messages to more than 10,000 unique recipients in a 24-hour period.”

NanitesMedia.com If anybody is looking for SMTP Server then I can provide you the best SMTP solution all you have to do just register with us i will give you the best SMTP server …

http://app.nanitesmedia.in/customer/index.php/guest/register For more information visit our website:—>> https://www.nanitesmedia.com/ or chat me on Skype:-- nanitesmedia@outlook.com

:–>>Ones the Signup and payment are done you just have to give us domain for SMTP Server Setup we will give the nameserver.

:–>>Our all the SMTP Server sending speed is 250 from 1 IP each hour. for example:-- 10 IP SMTP Server 25010=250024=60,000 in 24 hour and 18,00,000 email in 1 Month… In case if your IP gets blacklisted then we will change that IP. :–>>our all the IP has Neutral REPUTATION. :->>we are the only one who gives you guaranteed that in any manner your server will not get suspended.

1:-- Nanites Mail ( SMTP with 25 IP )

                   150,000 email/Day
                    validity 1 Month
                   Free MTA+VPS+APP
                     25 Dedicated IPs

Authentications – DKIM, SPF, DMARC, rDNS
Activate in 48 hours

2:-- Nanites Mail ( SMTP with 50 IP )

                    250,000 email/Day
                    validity 1 Month
                  Free MTA+VPS+APP
                    50 Dedicated IPs

Authentications – DKIM, SPF, DMARC, rDNS
Activate in 48 hours