Sending personalized bulk emails has never been easier — thanks to n8n + Google Sheets! In this step-by-step guide, I’ll show you how to build a fully automated cold email system using either Gmail or your custom SMTP, while logging every email’s status back into your Google Sheet in real time.
🔧 What’s Included in This Guide:
- ✅ Ready-to-use n8n workflow JSON files (for Gmail & SMTP)
- 🧠 JavaScript snippets for dynamic content and personalization
- ⏱ Built-in delay mechanism to prevent spam flags
- 📊 Real-time email status and timestamp logging
✅ Requirements
To get started, you’ll need:
- A free n8n instance (self-hosted or n8n cloud)
- A Google account with access to Google Sheets
- Gmail or SMTP email access
- A Google Sheet with:
- Sheet 1: List of leads (Name, Email)
- Sheet 2: Email templates (Subject, Body)
📂 Download Resources
🧩 JavaScript Snippets
🎯 Random Template Selector
jsCopyEditconst templates = items.map(item => item.json);
if (!templates || templates.length === 0) {
throw new Error('No templates found');
}
const index = Math.floor(Math.random() * templates.length);
const template = templates[index];
const bodyHtml = template.Body.replace(/\n/g, '<br>');
return [{
json: {
subject: template.Subject,
body: bodyHtml
}
}];
🙋♂️ Name Personalization (Set Node)
jsCopyEdit{{ $json.body.replace("[name]", $json["Name"] && $json["Name"].trim() !== '' ? $json["Name"].trim() : "there") }}
📬 Send Status Detection
Gmail Version:
jsCopyEdit{{ $json.labelIds[0] }}
SMTP Version:
jsCopyEdit{{ $json.response.includes("250 2.0.0 Ok") ? "SENT" : "Failed" }}
⏱ Timestamp Logging (Asia/Kolkata timezone)
jsCopyEdit{{ new Date().toLocaleTimeString("en-GB", { timeZone: "Asia/Kolkata", hour12: false }) }}
📊 Workflow Overview
Here’s what this automation does:
- 📋 Fetches leads from Sheet 1 (Name + Email)
- 📨 Fetches email templates from Sheet 2
- 🎲 Randomly selects one template
- 🧩 Replaces variables like
{{name}}
in the email body - ✉️ Sends the email using Gmail or SMTP
- ✅ Logs send status and timestamp back into Google Sheets
- ⏱ Waits for a short delay before sending the next email to prevent spam issues