Send personalized B2B cold outreach emails with Google Gemini and Gmail

Go to Workflow
0 views
Built by Nguyễn Thiệu Toàn (Jay Nguyen) Nguyễn Thiệu Toàn (Jay Nguyen)
Created on June 05, 2026

Description

Quick overview
This workflow runs on a schedule to pull leads from an n8n Data Table, fetches and cleans each lead’s website content, uses Google Gemini to draft a personalized cold outreach email in structured JSON, sends it via Gmail, and updates the lead status back in the Data Table.

How it works
Runs on a schedule and loads sender details, the n8n Data Table ID, email length limits, and rate-limiting settings.
Retrieves all leads from the n8n Data Table and checks each lead’s email address against a strict regex format.
Marks leads with invalid email addresses as INVALID_EMAIL in the n8n Data Table with an updated timestamp.
Fetches the lead’s website HTML and strips scripts, styles, and tags to produce a short plain-text website summary.
Sends the lead details, website summary, and sender context to Google Gemini to generate a personalized outreach email returned as a JSON object (subject, greeting, opening line, main body, ending).
Sends the generated email to the lead using Gmail with the AI-generated subject and body.
Updates the lead record in the n8n Data Table to SENT (including sent time and email subject) and waits for the configured delay to rate-limit sending.

Setup
Create or choose an n8n Data Table for your leads, ensure it includes fields like id, email, first_name, last_name, company_name, and website plus status tracking columns, and paste its ID into data_table_id in the Set Context step.
Add a Google Gemini (PaLM) API credential for the Google Gemini Flash model used to generate the outreach email.
Configure Gmail sending credentials (Google API) for the Gmail node, and verify the sending account is allowed to send outbound email.
Update the sender/company values and constraints in Set Context (sender name/email, company name/solution, max words, and rate-limit seconds) before activating the workflow.

Requirements
n8n Version:* Built and tested on *n8n 2.20.0+*. *(Note: You may encounter errors on older versions. It is highly recommended to update to the latest n8n version to use this workflow effectively).
Google Gemini** API key credentials.
Gmail OAuth2** credentials.
Built-in n8n Data Table feature enabled.

Customization
Change the Email Provider:* Swap out the *Gmail* node for an *Outlook* or *SMTP** node if you use a different mailing service.
Change the AI Model:* Replace the *Google Gemini* chat model with *OpenAI (ChatGPT)* or *Anthropic (Claude)** depending on your preference.
Integrate your CRM:* Instead of using n8n Data Table, replace the fetch and update nodes with your CRM of choice, such as *HubSpot* or *Pipedrive**.

Additional info
About the Author

Created by: Nguyễn Thiệu Toàn (Jay Nguyen)
Email: [email protected]
Website: nguyenthieutoan.com
Company: GenStaff (genstaff.net)
Socials (Facebook / X / LinkedIn): @nguyenthieutoan
More templates: n8n.io/creators/nguyenthieutoan

Nodes Used (6)

AI Agent
@n8n/n8n-nodes-langchain.agent
Code
n8n-nodes-base.code
Gmail
n8n-nodes-base.gmail
Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini
HTTP Request
n8n-nodes-base.httpRequest
Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured