Advertisement (728x90)
Automation

Build AI Cold Email Automator with Gemini

Learn how to build a simple Node.js script that uses Google's Gemini 2.5 Flash API to generate and write highly personalized cold emails to prospective clients.

9.1

AIbyPranav Verdict

Exceptional Quality
👍 Honest & Verified Review
Ease of Use 9.0 / 10
Features & Capabilities 9.2 / 10
Value for Money 9.5 / 10
Performance & Speed 9.0 / 10

👍 PROS

  • Step-by-step tutorial with full code snippets provided
  • Uses Gemini 2.5 Flash API which is extremely cost-effective
  • Ensures each cold email is highly personalized to increase response rates
  • Perfect project for student portfolios and automation engineers
  • Teaches basic integrations with Node.js and the Gemini SDK

👎 CONS

  • Requires basic knowledge of JavaScript and Node.js setup
  • Spam filters require careful volume controls on sending endpoints
  • API keys require secret variable setups to maintain security

The Power of Personalized Cold Email

Cold emails are highly effective for landing freelance clients or business partners. However, sending generic templates doesn't work; spam filters block them, and clients delete them. Personalization is key. By using the fast, cost-effective Gemini 2.5 Flash API, we can write a script that researches a client's website and drafts a unique email tailored to their business.

Prerequisites

To follow this tutorial, you need: If you want to refine your writing style or check for mistakes, you can use our ATS Resume Checker to polish your draft.

  • Node.js installed on your computer.
  • A Gemini API Key (free from Google AI Studio).
  • A spreadsheet or CSV containing client details (Name, Company, Website, Pain Point).

Step 1: Project Setup

Create a directory and initialize the project:

Advertisement (300x250)
mkdir email-automator
cd email-automator
npm init -y
npm install @google/generative-ai dotenv

Step 2: Writing the Code

Create a file named index.js and paste the following setup code: For other writing or productivity tasks, you can explore more options in our Sentence Rewriter.

const { GoogleGenAI } = require("@google/generative-ai");
require("dotenv").config();

const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });

async function draftEmail(clientName, company, painPoint) {
  const model = ai.getGenerativeModel({ model: "gemini-2.5-flash" });
  const prompt = `You are a professional business development representative. 
Write a short, compelling 3-sentence cold email to ${clientName} at ${company}. 
Focus on helping them solve this issue: "${painPoint}". 
Keep the tone professional, conversational, and direct. 
Do not use generic fluff. Use 'Pranav' as the sender.`;

  const response = await model.generateContent(prompt);
  console.log("-----------------------------------------");
  console.log(`To: ${clientName} (${company})`);
  console.log("-----------------------------------------");
  console.log(response.text.trim());
}

draftEmail("Rohan", "TechStart India", "Slow loading website landing page");

Step 3: Execution

Add your API key to a .env file (GEMINI_API_KEY=your_key) and run the script: node index.js. The console will print a personalized, highly tailored cold email draft instantly, ready for sending. For more details and official announcements, feel free to visit the Google AI Studio.

Conclusion

This simple script shows how easily you can build custom automation tools. In the future, you can integrate this with sending services like Resend or Nodemailer to automate your entire outreach workflow.

Related Articles

❓ Frequently Asked Questions

Are all AIbyPranav tools really free? +
Yes! Every tool is free with 5 daily AI runs. For unlimited usage, bring your own free Google Gemini API key from aistudio.google.com.
Do I need to sign up or create an account? +
No account needed. Just open any tool and start using it instantly. Your API key is stored only in your browser's localStorage — we have no backend.
Is my data private and secure? +
Absolutely. Your text goes directly from your browser to the Gemini API. We have no servers logging your inputs. Your API key never leaves your device.
Which AI model powers the tools? +
All tools use Google's Gemini 2.5 Flash — fast, capable, and optimized for writing, summarization, grammar, and creativity tasks.
Can I suggest a new tool or report a bug? +
Yes! Head to our Contact page and send us a Feature Request or Bug Report. We read every message and build tools based on user feedback.