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.
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.
- Go to Google Security Settings.
- 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.
- In the same "Security" section, search for "App Passwords" at the top.
- Enter a name (e.g.,
n8n-automation). - Click Create.
- 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:
| Parameter | Value |
|---|---|
| SMTP Host | smtp.gmail.com |
| Port (SSL) | 465 |
| Port (TLS/STARTTLS) | 587 |
| Username | Your full email address (e.g., [email protected]) |
| Password | 16-digit app password (no spaces) |
Part 3: Setting up for n8nβ
When creating credentials for the SMTP Node in n8n, do the following:
- Host:
smtp.gmail.com - Port:
465 - User: Your Email.
- Password: That very 16-digit code.
- Secure: Enable this toggle (for port 465).
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
587and changing the encryption type toSTARTTLS. 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.
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.