Skip to main content

Google Mail SMTP: Setup and Security

If you use Gmail or Google Workspace (formerly G Suite), you can send notifications and emails from your automations (e.g., n8n) through Google's servers. This ensures your emails won't end up in spam.

Attention

Google no longer supports SMTP login with regular account passwords. Third-party services require an App Password.


Part 1: Preparing Your Google Account​

Before setting up SMTP, make sure your account is ready.

1. Enable Two-Factor Authentication (2FA)​

This is a mandatory requirement. Without 2FA enabled, Google won't allow you to create an app password.

  1. Go to Google Security Settings.
  2. Find the section "How you sign in to Google" and enable 2-Step Verification.

2. Create an App Password​

This password is designed specifically for services like n8n or WordPress.

  1. In the same "Security" section, search for "App Passwords" at the top.
  2. Enter a name (e.g., n8n-automation).
  3. Click Create.
  4. Copy the 16-digit code. You'll only see it once!

Part 2: SMTP Server Configuration​

Use these details to connect in n8n, CRM, or any other application:

ParameterValue
SMTP Hostsmtp.gmail.com
Port (SSL)465
Port (TLS/STARTTLS)587
UsernameYour full email address (e.g., [email protected])
Password16-digit app password (no spaces)

Part 3: Setting up for n8n​

When creating credentials for the SMTP Node in n8n, do the following:

  1. Host: smtp.gmail.com
  2. Port: 465
  3. User: Your Email.
  4. Password: That very 16-digit code.
  5. Secure: Enable this toggle (for port 465).
Sender Verification

In the "From Email" field within the n8n workflow, always specify the same address you used for authentication. Google may block emails if the sender address doesn't match the SMTP login.


Part 4: Possible Issues​

"Authentication Failed" Error​

  • Make sure you copy the entire app password without extra spaces.
  • Check that you haven't accidentally deleted this password in Google settings.

"Connection Timeout" Error​

  • Try switching the port to 587 and changing the encryption type to STARTTLS. Some hosting providers block port 465 for security reasons.

Email Sends But Doesn't Arrive​

  • Check the "Spam" folder.
  • Make sure SPF and DKIM records are configured in Cloudflare for your domain (if it's Google Workspace). Without them, major email services may reject your emails.

Summary​

Now your bots and systems can communicate with customers on your behalf through Google's reliable infrastructure.

Recommendation

For mass mailings (more than 500-2000 emails per day), it's better to use specialized services like SendGrid or Mailgun, as Google has limits on sending via SMTP.