🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

Mailgun + Gmail: outbound sent, replies drafted

Lisa Granqvist Partner Workflow Automation Expert

Outbound breaks in the boring places. A lead replies, your CRM isn’t updated, the thread gets missed, and suddenly the “simple follow-up” turns into a messy, manual chase.

This Gmail reply drafts automation hits SDRs first, honestly. But founders running their own outreach and agency leads juggling multiple campaigns feel the same friction. You get consistent follow-ups without giving up human review.

You’ll see how this workflow sends personalized sequences through Mailgun, watches for Gmail replies from known contacts, then drafts ready-to-send responses while keeping your lead status current.

How This Automation Works

Here’s the complete workflow you’ll be setting up:

n8n Workflow Template: Mailgun + Gmail: outbound sent, replies drafted

Why This Matters: Replies Slip Through and Revenue Leaks

Outbound isn’t hard because sending is hard. It’s hard because you’re operating a mini system: timing, personalization, status updates, routing, and response handling. When that system lives in someone’s memory (or a half-updated spreadsheet), the cracks show fast. Replies arrive at the worst time, threads get buried in Gmail, and the “we’ll respond today” promise turns into tomorrow. Meanwhile you’ve got no clean view of who replied, who bounced, and who needs a second touch.

The friction compounds. Here’s where it breaks down in real teams.

  • You end up copying lead context into email replies, which slows you down and makes tone inconsistent.
  • Status updates happen after the fact, so reporting is always a step behind reality.
  • Sequences keep sending to people who already replied because the “stop” signal isn’t automated.
  • When multiple people share an inbox, ownership gets fuzzy and good replies go stale.

What You’ll Build: Mailgun Sequences + Gmail Reply Drafting

This workflow is a three-part pipeline that behaves like a lightweight outbound engine. On a schedule, it pulls leads from your database (Supabase/Postgres) and sends personalized outreach sequences through Mailgun. As emails go out, the workflow logs what happened so you always know which step a lead is on. Then, when a lead replies in Gmail, the workflow checks that the sender matches a contact in your database, pulls thread history for context, and uses AI (OpenAI/Anthropic) to classify intent and draft a reply. Instead of auto-sending, it creates a Gmail draft so you can review and approve before anything goes out.

The workflow starts with scheduled outreach runs and controlled throttling (batching plus waits) so deliverability doesn’t get wrecked. In parallel, a Gmail listener handles inbound replies, updates lead status, and generates a clean, on-brand draft response that’s already grounded in the thread history.

What You’re Building

Expected Results

Say you run 200 outbound emails a day across a 3-step sequence and you get 10 replies. Manually, you might spend about 2 minutes logging activity per reply and another 6 minutes reading context and drafting, which is roughly 80 minutes just on response handling. With this workflow, replies get matched to the right lead automatically and a draft shows up in Gmail in a few minutes. You still review and send, but the “blank page” time mostly disappears.

Before You Start

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • Mailgun for sending your outbound sequences.
  • Gmail to detect replies and create drafts.
  • OpenAI or Anthropic API key (get it from your model provider dashboard).

Skill level: Intermediate. You’ll connect credentials, map a few fields, and understand where your lead data lives.

Want someone to build this for you? Talk to an automation expert (free 15-minute consultation).

Step by Step

Scheduled outreach runs. On a schedule, the workflow fetches leads from your Supabase/Postgres tables, sorts and caps the batch size, then routes leads into the right sequence step based on their current status.

Paced sending through Mailgun. Emails are dispatched via Mailgun nodes in split batches, with wait periods between sends. That pacing is there for a reason: it keeps volume controlled and makes failures easier to retry without blasting duplicates.

Reply detection in Gmail. A Gmail trigger listens for new inbound messages, extracts the sender address, checks it against your campaign and database records, and marks the lead as replied in Postgres so the sequence can stop.

AI drafts with context. The workflow pulls the thread history, runs structured parsing and intent classification (OpenAI/Anthropic), then generates a reply draft and saves it as a Gmail draft. You review, tweak if needed, and hit send.

You can easily modify the draft tone and classification labels to match your sales process. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Scheduled Triggers

This workflow uses multiple schedule-based entry points to fetch and process outreach data at different intervals.

  1. Open Scheduled Trigger A and set your desired schedule for initial lead fetching.
  2. Open Scheduled Trigger B and configure a schedule for pull-based outreach sequence generation.
  3. Open Scheduled Trigger C and set timing for send-time evaluation.
  4. Open Scheduled Trigger D and set timing for the secondary send-time evaluation stream.

Step 2: Connect Supabase Data Sources

Supabase is the core data source for leads, campaign state, and updates. Multiple Supabase nodes handle reads and writes.

  1. Open Supabase Fetch A, Supabase Fetch B, Supabase Fetch C, and Retrieve Many Rows, then connect credentials and set your table/query settings.
  2. Open Leads Table Lookup and map the lookup fields used for lead matching.
  3. Open all update/insert nodes (Supabase Update A through Supabase Update F, plus Insert New Leads) and ensure the correct table and field mappings.
  4. Credential Required: Connect your Supabase credentials to all Supabase nodes (12+ nodes across fetch, lookup, insert, and update steps).

Step 3: Set Up AI/LLM Processing

AI nodes generate research, analyze leads, draft sequences, and assist with scraping and replies. Ensure language models and parsers are connected correctly.

  1. Open Company Research and General Analysis, then connect OpenAI credentials for each OpenAI node.
  2. Open Compose Email Sequence and confirm OpenAI Chat Core is connected as the language model; add OpenAI credentials to OpenAI Chat Core.
  3. Open Scraping Agent and confirm OpenAI Chat Assist is connected; add OpenAI credentials to OpenAI Chat Assist.
  4. Open Draft Response Agent and ensure Anthropic Chat Core is connected as the language model; add Anthropic credentials to Anthropic Chat Core.
  5. For AI tools/sub-nodes like Structured Parser A, Structured Parser B, Parse Email Response, Retrieve Email History, Review Sent History, and Buffer Memory, add credentials to the parent nodes (Compose Email Sequence, Scraping Agent, or Draft Response Agent), not the sub-nodes.
  6. Credential Required: Connect your OpenAI credentials to Company Research, General Analysis, OpenAI Chat Core, OpenAI Chat Assist, and Audio Transcription.
  7. Credential Required: Connect your Anthropic credentials to Anthropic Chat Core.

Step 4: Configure Lead Enrichment & Scraping Flow

This path builds queries, runs Apify scraping, validates emails, and inserts new leads.

  1. Open Detect Voice or Text and verify the routing to Telegram File Download and Set Text Payload.
  2. Open Telegram File Download and Telegram User Trigger, then connect Telegram credentials.
  3. Open Generate URL and Run Apify Actor to set the actor and input schema.
  4. Confirm Scraping Agent outputs to both Build Query Payload and Fetch Scraped Emails in parallel.
  5. Open Fetch Scraped Emails, Run SQL Query, and Mark Replied Yes to connect PostgreSQL credentials.
  6. Credential Required: Connect your Apify credentials in Run Apify Actor.
  7. Credential Required: Connect your PostgreSQL credentials in Fetch Scraped Emails, Run SQL Query, and Mark Replied Yes.

Step 5: Configure Routing, Batching, and Send-Time Logic

Sorting, routing, and batching nodes determine how outreach sequences are throttled and scheduled.

  1. Verify that Branch Check A, Branch Check B, Branch Check C, and Branch Check D route to the correct sort or utility nodes.
  2. Review Sort Records A through Sort Records D and the limit nodes Cap Records, Cap Records B, Cap Records C, Cap Records D, and Cap Records E to confirm volume caps.
  3. Confirm Cap Records outputs to both Combine Streams and Company Research in parallel.
  4. Open Route by Case, Route by Case B, and Route by Case C to ensure each case routes into the correct batch node.
  5. Review all batching and delay nodes (Iterate Batch AIterate Batch F and Pause APause F) to align send pacing.

Step 6: Configure Email Dispatch & Updates

Mailgun handles outbound email sending, while Supabase updates track results.

  1. Open Mailgun Dispatch A through Mailgun Dispatch F and connect your Mailgun credentials.
  2. Verify each Iterate Batch node outputs to both the appropriate Supabase Update node and its corresponding Mailgun Dispatch node.
  3. Confirm Timezone Builder and Sender Address produce the expected fields before Leads Table Lookup.
  4. Credential Required: Connect your Mailgun credentials to all Mailgun nodes (6 nodes).

Step 7: Configure Reply Handling & Draft Creation

Incoming replies are parsed and used to draft responses in Gmail.

  1. Open Gmail Trigger Listener and connect Gmail credentials to listen for replies.
  2. Open Fetch Email Message and Create Draft Email and connect Gmail credentials for message retrieval and draft creation.
  3. Ensure Draft Response Agent receives the email content from Fetch Email Message and uses Parse Email Response as its output parser.
  4. For Retrieve Email History and Review Sent History (Gmail tools), add Gmail credentials to the parent node Draft Response Agent, not the tool sub-nodes.
  5. Credential Required: Connect your Gmail credentials to Gmail Trigger Listener, Fetch Email Message, and Create Draft Email.

Step 8: Configure Telegram Notifications

Telegram provides lead intake and confirmation alerts for newly inserted leads.

  1. Open Telegram User Trigger and connect Telegram credentials to enable inbound messages.
  2. Open Telegram Confirmation and ensure it is connected to Prepare Telegram MessageCap Records E.
  3. Credential Required: Connect your Telegram credentials to Telegram User Trigger, Telegram File Download, and Telegram Confirmation.

Step 9: Test and Activate Your Workflow

Test each entry point to validate end-to-end behavior before enabling schedules in production.

  1. Use Execute Workflow with Scheduled Trigger A to confirm records flow through Supabase Fetch ASort Records CBranch Check BRoute by CaseIterate Batch A/BMailgun Dispatch nodes.
  2. Manually run Gmail Trigger Listener (or simulate input) and confirm it reaches Create Draft Email via Draft Response Agent.
  3. Trigger Telegram User Trigger with both voice and text to verify Detect Voice or Text routes correctly.
  4. Successful execution should show sent email actions in Mailgun nodes, updates in Supabase nodes, and draft creation in Gmail.
  5. Once verified, toggle each scheduled trigger to Active to run automatically.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Troubleshooting Tips

  • Gmail credentials can expire or need specific permissions. If things break, check the connected Google account and OAuth scopes in n8n credentials first.
  • If you’re using Wait nodes or external processing, timing varies. Bump up the wait duration if downstream steps fail because a prior update hasn’t landed yet.
  • Mailgun sending can fail silently when domains aren’t verified or you hit account limits. Confirm your sending domain status and review Mailgun logs for bounces before changing the workflow.

Quick Answers

What’s the setup time for this Gmail reply drafts automation?

About 60 minutes if your Mailgun, Gmail, and database are ready.

Is coding required for this Gmail reply drafts?

No. You’ll mostly connect accounts and map your lead fields. The workflow includes code nodes, but you can usually leave them as-is.

Is n8n free to use for this Gmail reply drafts workflow?

Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenAI/Anthropic API usage, which is typically a few cents per drafted reply.

Where can I host n8n to run this automation?

Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.

Can I modify this Gmail reply drafts workflow for different use cases?

Yes, and you should. Common tweaks include changing the prompts in the Draft Response Agent to match your voice, swapping the intent categories in the structured parser, and adjusting the Mailgun sequence logic so it reflects your steps (for example: intro, follow-up, breakup). You can also route “pricing” replies to a different label or Slack alert by editing the switch/if branches around classification.

Why is my Gmail connection failing in this workflow?

Most of the time it’s an expired OAuth session or missing Gmail permissions. Reconnect the Gmail credential in n8n, then confirm the trigger is watching the right mailbox and label filters aren’t excluding messages. If it fails only on certain threads, check that the workflow can fetch the full email and history for that conversation.

What volume can this Gmail reply drafts workflow process?

On n8n Cloud Starter, expect a few thousand executions per month, which is enough for many small outbound programs.

Is this Gmail reply drafts automation better than using Zapier or Make?

It depends on how strict you are about control and scale. Zapier/Make can be fine for basic “new email → create draft” logic, but this workflow is doing more: batching, multi-branch routing, database lookups, thread history retrieval, structured AI outputs, and status updates that stop sequences. n8n handles that kind of branching without turning every path into a separate billable task. The self-host option is also a big deal if you run outreach daily. If you’re unsure, Talk to an automation expert and we’ll sanity-check your setup.

Once this is running, outbound feels calmer. Replies get handled, drafts show up where your team already works, and your lead statuses stop drifting out of sync.

Need Help Setting This Up?

Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal