Gmail + Ollama: instant replies for common inquiries
Your inbox doesn’t get “busy.” It gets messy. Same questions, same requests, same people waiting while you copy-paste yet another reply (and still manage to miss a detail).
Marketing managers feel it when leads go cold. Travel agents feel it when “Can you confirm the booking?” piles up overnight. And small business owners feel it because inbox time steals from everything else. This Gmail Ollama replies automation drafts consistent responses fast, so you answer more messages without living in Gmail.
You’ll set up an n8n workflow that reads new emails, drafts a helpful reply with Ollama, then sends it out automatically. You’ll also learn where to customize it so it sounds like you, not like a bot.
How This Automation Works
Here’s the complete workflow you’ll be setting up:
n8n Workflow Template: Gmail + Ollama: instant replies for common inquiries
flowchart LR
subgraph sg0["Ollama Model Flow"]
direction LR
n0@{ icon: "mdi:robot", form: "rounded", label: "Ollama Model", pos: "b", h: 48 }
n1@{ icon: "mdi:message-outline", form: "rounded", label: "Trigger From Mail (IMAP)", pos: "b", h: 48 }
n2@{ icon: "mdi:robot", form: "rounded", label: "Basic LLM", pos: "b", h: 48 }
n3@{ icon: "mdi:swap-vertical", form: "rounded", label: "Email Field Setup", pos: "b", h: 48 }
n4@{ icon: "mdi:message-outline", form: "rounded", label: "Sending Email", pos: "b", h: 48 }
n2 --> n3
n0 -.-> n2
n3 --> n4
n1 --> n2
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n0,n2 ai
Why This Matters: Slow Replies Create Silent Lost Sales
Most inbox backlogs aren’t “hard” emails. They’re repetitive ones that still require attention: pricing questions, booking confirmations, availability checks, “can you resend that,” and quick clarifications. Each message seems small, but they arrive in waves, especially after a campaign, a weekend, or a time-zone gap. When you respond late, people don’t complain. They just move on. And when you rush, you make tiny mistakes (wrong name, missing detail, weird tone) that cost trust you can’t easily rebuild.
The friction compounds. Here’s where it usually breaks down.
- You end up rewriting the same “standard” replies, and it eats about an hour a day once volume picks up.
- Fast manual replies often skip context, which leads to extra back-and-forth and more inbox load tomorrow.
- When multiple people reply from the same inbox, tone and promises drift, so customers get inconsistent answers.
- Missed emails don’t look like a problem until you realize the lead already booked elsewhere.
What You’ll Build: AI-Drafted Replies Sent Automatically from Gmail
This workflow watches your inbox for new messages and responds with a solid draft reply generated by Ollama (running as your language model). When an email arrives, n8n pulls the sender, subject, and body, then hands that content to an AI “chain” that prepares a context-aware response. Next, the workflow formats the response into proper email fields (recipient, subject line, message body) so it looks like a normal reply, not a pasted chat message. Finally, it sends the email automatically through n8n’s outbound email step. The goal is simple: common inquiries get answered quickly and consistently, even when you’re offline.
The workflow starts with an IMAP email trigger that detects new messages. Ollama drafts the reply through the Core LLM Chain, then n8n packages that text into a ready-to-send email. The last node sends it out, which means your inbox gets handled while you’re in meetings or asleep.
What You’re Building
| What Gets Automated | What You’ll Achieve |
|---|---|
|
|
Expected Results
Say you receive about 30 “common inquiry” emails a day, and each one takes maybe 4 minutes to read, think, and reply. That’s roughly 2 hours daily stuck in the same loop. With this workflow, your “work” becomes checking that Ollama’s draft matches your policy, then letting it send. If you only review the tricky 10 and let 20 go out automatically, you’re getting back about an hour most days.
Before You Start
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Gmail (or IMAP inbox access) to monitor incoming messages.
- Ollama to generate drafts using a local or hosted model.
- Email sending account (SMTP or provider credentials in n8n).
Skill level: Beginner. You’ll connect email credentials and tweak a prompt, but you won’t write code.
Want someone to build this for you? Talk to an automation expert (free 15-minute consultation).
Step by Step
A new email arrives in your inbox. The IMAP Email Trigger checks for unread (or newly arrived) messages and passes the email content into the workflow. If you want to limit scope, you can filter by sender, subject keywords, or a specific folder/label.
The message is handed to the AI drafting step. The Core LLM Chain takes the email text and asks Ollama to generate a reply that matches your intended purpose (FAQ response, confirmation, next steps, and so on). This is where you define your tone, your allowed promises, and anything the model must never say.
Email fields are prepared for sending. The “Prepare Email Fields” step maps the AI output into a proper email body and sets recipient details from the original sender. It can also standardize subjects like “Re: [original subject]” so replies thread cleanly.
The reply is dispatched automatically. The Send Email node sends the drafted response. From the recipient’s side, it looks like a normal, timely reply from your business email.
You can easily modify which emails trigger replies to match your real-world rules (VIP clients, refund requests, or anything sensitive). See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the IMAP Trigger
Set up the inbound email trigger so the workflow starts when new itinerary requests arrive.
- Add the IMAP Email Trigger node as your start node.
- Credential Required: Connect your imap credentials.
- In Options, set Custom Email Config to
["UNSEEN", ["SUBJECT", "itinerary"]]to filter unread emails with “itinerary” in the subject.
Step 2: Connect the AI Language Model
Attach the LLM provider that will generate the itinerary text.
- Add the Ollama Language Engine node.
- Credential Required: Connect your ollamaApi credentials.
- Set Model to
llama3.2-16000:latest. - Connect Ollama Language Engine to Core LLM Chain using the ai_languageModel connection.
Note: Ollama Language Engine is connected as the language model for Core LLM Chain—ensure credentials are added to Ollama Language Engine, not the chain.
Step 3: Set Up the AI Itinerary Generation
Configure the LLM chain to transform inbound email content into a travel itinerary.
- Add the Core LLM Chain node.
- Set Text to
={{ $json.textPlain }}. - Keep Prompt Type as
define. - Ensure the custom prompt message is included exactly as provided to enforce the structured “Day 1…Day N” itinerary output.
⚠️ Common Pitfall: Editing the prompt structure can cause the itinerary to deviate from the required daily format. Preserve the “Day 1:” pattern and the instruction to match the number of days in the email.
Step 4: Configure the Email Preparation and Dispatch
Map the generated itinerary into email fields and send the reply.
- Add the Prepare Email Fields node and connect it to Core LLM Chain.
- Set the from field to
={{ $('IMAP Email Trigger').first().json.from }}. - Set the subject field to
=Re: {{ $('IMAP Email Trigger').first().json.subject }}. - Set the text field to
={{ $json.text }}. - Add the Dispatch Outbound Email node and connect it to Prepare Email Fields.
- Credential Required: Connect your smtp credentials.
- Set Text to
={{ $json.text }}, Subject to={{ $json.subject }}, and To Email to={{ $json.from }}. - Set From Email to
[YOUR_EMAIL]and Email Format totext.
Step 5: Test and Activate Your Workflow
Validate the flow end-to-end before turning it on for production use.
- Click Execute Workflow and send a test email that includes the word “itinerary” in the subject.
- Confirm IMAP Email Trigger receives the email and passes
textPlaininto Core LLM Chain. - Verify Dispatch Outbound Email sends a reply with a clean, day-by-day itinerary and a
Re:subject. - When successful, toggle the workflow to Active to enable continuous processing.
Troubleshooting Tips
- Gmail/IMAP credentials can expire or require “app password” access. If the trigger stops detecting emails, check your email provider security settings first.
- If Ollama is self-hosted, its URL can change (or the service can go to sleep). Confirm the Ollama endpoint is reachable from your n8n instance before blaming the prompt.
- Default AI prompts are usually too generic for real customer comms. Add your policies (refund rules, office hours, what you can promise) early or you’ll be correcting replies forever.
Quick Answers
About 30 minutes if your email credentials and Ollama are already working.
No. You’ll connect accounts and edit a couple of text fields (mainly the AI prompt).
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 Ollama hosting costs if you’re not running it locally.
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.
Yes, and you should. Most customizations happen in the Core LLM Chain (the instructions you give the model) and in Prepare Email Fields (how the subject/body are formatted). Common tweaks include only replying to certain keywords, adding business rules like “never confirm refunds,” and inserting a standard signature or booking link.
Usually it’s an authentication issue, not the workflow itself. Gmail often requires app passwords (or the right IMAP permissions), and credentials can silently expire after security changes. Also confirm IMAP is enabled on the mailbox and that you’re pointing to the correct folder if you’re monitoring labels. If it fails only during busy periods, you may be hitting provider throttling, so slow down polling and avoid checking too frequently.
On n8n Cloud Starter, you can handle a modest daily inbox comfortably, and higher tiers cover larger volumes. If you self-host, there’s no execution cap from n8n, but your server and Ollama model speed become the limit. Practically, most teams start by auto-replying only to a handful of common categories, then expand once the drafts look reliable.
Often, yes, because you can run Ollama locally, add more logic without paying per branch, and keep tighter control of the full email flow. Zapier and Make are great for quick, simple automations, but AI-driven email replies tend to need better filtering, memory/context, and safety rules. n8n is built for that kind of “real workflow,” honestly. The trade-off is you’ll spend a bit more time setting it up the first time. If you want help choosing, Talk to an automation expert.
Once this is live, your inbox stops being a daily fire drill. The workflow handles the routine replies, and you only step in when it actually needs a human.
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.