How to Set Up SMTP in Gmail Using an App Password

Saurabh Nakoti
2 min readOct 1, 2023

Introduction:

Email communication is an integral part of our digital lives, and configuring SMTP (Simple Mail Transfer Protocol) settings can be a bit tricky. In this guide, we’ll walk you through the process of setting up SMTP in Gmail using an app password, which offers enhanced security when using email clients or applications.

1. Enable 2-Step Verification:

Before setting up SMTP using an app password, it’s crucial to enhance the security of your Gmail account. Start by enabling 2-step verification:

  • Visit your Google Account settings at https://myaccount.google.com/.
  • Sign in to the Gmail account you want to use for SMTP.
  • Navigate to “Security” in the left sidebar.
  • Under “Signing in to Google,” find and enable 2-step verification. Follow the on-screen instructions to set it up with your phone number or an authenticator app.

2. Generate an App Password:

  • After enabling 2-step verification, proceed to generate an app-specific password:
  • In the “Security” section, click on “App passwords” or search it for the top search bar and click on it.
  • Provide a custom name for the app, like “SMTP for My Email Client.”
  • Click the “Create” button to create a unique 16-character app-specific password.

3. Copy the App Password:

  • Copy the generated app-specific password to your clipboard. You’ll need it for configuring your email client.

4. Enable Enhanced Safe Browsing:

  • To enhance the security of your Gmail account further, consider enabling “Enhanced Safe Browsing for your account”
  • You can enable it in your Google Account settings under “Security.”

5. Configure SMTP Server and Port:

  • Gmail’s SMTP server: smtp.gmail.com
  • For TLS (Transport Layer Security): Port 587
  • For SSL (Secure Sockets Layer): Port 465

TLS or SSL:

  • TLS (Transport Layer Security) and SSL (Secure Sockets Layer) are encryption protocols that secure the communication between your email client and Gmail’s SMTP server.

Username and Password:

  • Your Gmail email address is used as the SMTP username.
  • An app-specific password generated from your Google Account settings is used as the SMTP password. This adds an extra layer of security and ensures your main Google account password remains safe.

Conclusion:

By following these steps, you can set up SMTP in Gmail using an app password, enhancing the security of your email communication. This method allows you to use email clients and applications while keeping your Google account password safe. Enjoy seamless and secure email sending!

Thank you for your interest in reading my story on Medium! Keep reading, keep learning.

--

--

Saurabh Nakoti

Experienced Python developer focused on creating applications. Proficient in Django, Flask, FastAPI, MongoDB, AWS, Linux, SQL.