
Affiliate disclosure: some links in this article may be affiliate links. If you sign up through them, we may earn a commission at no extra cost to you. See our Terms of Service.
Someone writes to the email address on your website: “Hi, how does your service work?” You are busy, you see it three hours later, and by then they may have written to your competitor. An AI email autoresponder tries to fix exactly that moment. It reads each new message, decides whether it comes from a real prospect, writes a short personal answer and sends it, without waiting for you.
This free n8n workflow is a small, six-step version of that idea. It watches a mailbox over IMAP, asks GPT-4o whether the message is a lead, drops everything that is not, has GPT-4o write a reply, and sends it through Gmail. It is short enough to understand in one sitting, which makes it a good way to learn how automatic replies work. It is also a template that can answer the wrong person, answer twice, or promise something you cannot do if you switch it on without reading it. In this guide we explain every step in plain English, show where the logic is fragile, say what we changed in the file and why, and list what we could not check.
Read this first: it answers real people with AI text that nobody reviews
- It does not know who is writing. There is no check for newsletters, automatic mail, mailing lists, spam or phishing. Whatever the AI calls a lead gets an answer.
- The sender can talk to your AI. The full message text is passed to the model, so a sender can write instructions into it.
- The reply step may not work, or may fire several times. The mailbox you watch and the Gmail account that replies are set up separately, and the search step in between can return no message or several.
- The original prompt promised a phone call. The example reply in the template said someone would call “in a couple of minutes”. We replaced it, because an AI copies that kind of promise.
Use a test mailbox and your own addresses first. This guide is not legal advice.
Template source: this workflow comes from the n8n Library at n8n.io, the public collection of workflow templates. We did not create it. LeenLabs prepared its JSON for publication and documented it. What we changed is listed in the section What we changed in the original template.
At a glance
- What it does: reads new emails, has an AI decide whether each is a lead, and sends an AI-written reply to the ones that are.
- Apps used: n8n, an IMAP mailbox, OpenAI (GPT-4o) and Gmail.
- Trigger: a new email in the mailbox folder you choose.
- Setup effort: medium. Two email connections and an AI key.
- Cost to run: the file is free. Each incoming email uses at least one AI call, two for leads.
- Watch out for: replies to the wrong senders, injected instructions, invented promises, repeated replies, a reply step that may fail, and personal data going to other services.
- Test status: the file was checked for structure and the search text was built on simulated emails. No node was run in n8n and no service was contacted.
In this guide
- Answering new email leads automatically: what this workflow does
- Email leads, lead scoring and what the AI really decides
- Words you will see in this guide
- Apps and accounts this workflow talks to
- What to have ready before you import anything
- Where the logic is fragile: worked examples
- The big picture: from email to reply
- Follow the data: what each of the 6 steps does
- Get the workflow JSON
- Install it in ten steps
- Auto-replying to spam and phishing: how to spot a phishing email first
- What it will not do: limits, costs and trade-offs
- Access, privacy and responsible use
- Problems you may meet and how to fix them
- Too much of a puzzle? Let us build or adapt it for you
- What we changed in the original template
- What was verified, and what was not
- Five ways to adapt the workflow
- Frequently asked questions
- Tools used in this workflow
- Suggested reading
- Keep exploring
Answering new email leads automatically: what this workflow does
In one run, for one new email, the workflow does these jobs:
- Catches a new message in the mailbox folder you chose.
- Asks GPT-4o whether the sender looks interested in your service, and expects a short true or false answer.
- Stops if the answer is not true.
- Writes a short reply with GPT-4o, using the message text and a prompt you edit.
- Searches Gmail for messages from the same sender with the same subject.
- Sends the reply as a plain-text answer.
It suits a person who receives a small amount of inbound mail from people asking about one service, and who wants to learn how automatic replies are built. It does not suit you if you get a lot of mail, if mistaken replies would cost you a customer or a reputation, or if you need a log, a human approval step or a way to stop two automatic systems answering each other, unless you add those things.
Email leads, lead scoring and what the AI really decides
Email leads are people who contact you by email and might buy. Here the “lead” decision is a single yes or no from an AI model, based only on the plain text of the message and one sentence of instructions from you. That is a classification, not lead scoring. Lead scoring gives each contact points, for example for opening emails, visiting pages or coming from a company email domain, and subtracts points for inactivity or bounces, so you can rank them. This workflow does none of that: it keeps no history, no points and no record of who was a lead. A message is a lead or it is not, and the next message from the same person starts from zero.
It also does not look for leads, and it does not research email addresses. It only reacts to mail that arrives. If you are looking for tools that find contacts, or for outbound messages, this is the wrong template; our outbound outreach workflow covers the sending side.
Words you will see in this guide
- n8n (say “n-eight-n”): a tool that connects apps and makes them follow your instructions automatically.
- Workflow: one set of instructions in n8n, drawn as boxes connected by lines.
- Node: one box in a workflow. Each node does one job.
- Trigger: the node that starts a workflow. Here, a new email.
- Autoresponder: software that answers incoming email by itself.
- IMAP: a standard way for programs to read a mailbox on a mail server. Most email providers offer it, sometimes after you switch it on.
- Lead: a person or company that might buy from you.
- Classification: sorting something into a group. Here, lead or not lead.
- Prompt: the instructions and data sent to an AI model for one job.
- Prompt injection: text inside the data that tries to give the AI new instructions, such as “ignore the rules above”.
- JSON: a plain text format for structured data, such as {“lead”: “true”}.
- Plain text: an email without formatting. Many emails also carry an HTML version, which can be the only version.
- Message id: a code that identifies one email. IMAP and Gmail do not use the same code.
- Credential: a saved login that lets n8n use one of your accounts. The JSON file does not contain yours.
Apps and accounts this workflow talks to
- n8n: runs the workflow. It has to stay running, because it listens for mail.
- An IMAP mailbox: the inbox it watches. It can be Gmail or another provider.
- OpenAI: the AI model, GPT-4o, called twice for a lead. The text of each incoming email is sent to it.
- Gmail: used to find the original message and to send the reply, from the account you connect.
Costs: the workflow file is free. n8n, OpenAI and your email provider each have their own plans, limits and prices, which change, and we have not verified any of them. Every incoming email costs at least one AI call, including spam.
What to have ready before you import anything
- A test mailbox with IMAP switched on, and its server address, port and password or app password. Do not start on your main inbox.
- A Gmail account for the reply. For this workflow to work, it should be the same mailbox you watch (we explain why below).
- An OpenAI key and its credential in n8n.
- A one-sentence description of what you sell, your name and your company, to replace the placeholders in the prompts.
- Three or four test emails you will send yourself: a real-looking enquiry, an unrelated message, a newsletter-style message and one with an odd subject.
Where the logic is fragile: worked examples
This template contains no Code node, so there was no code to run outside n8n. What we could do was read the settings and build the text the workflow builds on simulated emails.
The Gmail search
The search step builds a Gmail search from the sender and the subject of the incoming message, in this form: sender in quotes, then subject in quotes. We built it on two simulated emails:
| Simulated email | Search text built |
|---|---|
From Jane Smith <jane@x.com>, subject Question about pricing |
from:"Jane Smith <jane@x.com>" subject:"Question about pricing" |
Same sender, subject Re: "Cleaning" quote |
from:"Jane Smith <jane@x.com>" subject:"Re: "Cleaning" quote" (the quotes inside the subject break the quoting) |
We did not run these searches in Gmail, so we do not know exactly how Gmail reads the second one, or whether it accepts the sender in that form. We can say that the search is built from raw email text, and that real subjects contain all kinds of characters.
How many replies go out
The search step returns every Gmail message that matches. The reply step then runs once for each match. So:
| Messages the search finds | Replies the workflow attempts |
|---|---|
| 0 (for example, the mailbox watched is not this Gmail account) | None. The workflow ends without an error that tells you. |
| 1 | One. |
| 3 (the same person wrote three times with the same subject, for example in a thread) | Three, each with the same text and the same message id. |
The reply text and the message id it answers both come from the email that started the run, not from the search result. The search result only decides how many times the reply step runs. That is how the template is wired, and it is why we call this step fragile.
The message id
The reply step is given the message-id of the original email as read by the IMAP trigger. Gmail’s reply function works with Gmail’s own identifier for a message. We believe these are two different codes, which would make the reply fail or attach to nothing, but we could not confirm it in n8n. Test this first. If it fails, take the id from the search step’s output instead.
The AI answer for the lead check
The prompt asks for JSON in the form {“lead”: “<true/false>”}, and the filter then turns the value into a yes or no with a text-to-boolean conversion. If the model answers with a real true instead of the text “true”, or with something else, we did not confirm what the conversion does. We could not run the AI node, so we do not know how often GPT-4o follows the format exactly.
The big picture: from email to reply
- Catch. A new email arrives in the watched folder.
- Classify. The AI says lead or not lead.
- Filter. Only leads continue.
- Write. The AI writes a reply.
- Find. Gmail is searched for the original message.
- Send. The reply is sent, once per message found.
Follow the data: what each of the 6 steps does
The names below are the names you will see on the canvas.
Email Trigger (IMAP)
Connects to your mailbox through an IMAP credential and starts the workflow for each new message. It is set to leave messages as they are, so it does not mark them as read or move them. We could not confirm how this trigger decides what is “new” in your version, for example after you turn the workflow off and on. The risk is that old, still-unread messages are handled again. Test this by restarting the workflow on a mailbox that holds a few messages.
Filter leads
An OpenAI node using GPT-4o. It receives one instruction, “Indicate if the following message is a lead that’s interested in my YOUR_SERVICE_OR_OFFER”, followed by the plain-text body of the email, and it is set to return JSON. You replace the placeholder with what you sell. If an email has no plain-text part, the AI receives an empty message and may still answer. The message is inserted as it is, so a sender can include instructions in it.
Filter
A filter that lets a message through only if the lead answer, converted to a yes or no, is true. Messages that do not pass stop here. Nothing records them and nobody is told.
Reply with customized message
A second OpenAI node. It receives a list of messages: the instructions, an example question, an example answer, and then the real email text. The first two messages carry no role in the file, so the instructions reach the AI as ordinary messages and not as a system message; we left that as it is. In the file we received, the example was a named person asking about a high-ticket offer with a stated monthly commitment, and the example answer was signed with the author’s names and said that someone from the team would phone within a couple of minutes. LeenLabs replaced the instructions and the example with neutral ones, described below. You replace YOUR_BUSINESS_AND_SERVICE, YOUR_NAME, YOUR_COMPANY and YOUR_ONE_LINE_DESCRIPTION.
Get Message
A Gmail node set to get all messages that match a search built from the sender and the subject of the original email. The note in the file said it “retrieves the full details of the original email”, but its output is not used by the reply step except for deciding how many times it runs. If the mailbox you watch is not this Gmail account, it finds nothing and the run ends quietly.
Reply to Message
A Gmail node set to reply, as plain text, with the AI’s text, to the message identified by the IMAP message-id. It sends from the Gmail account you connect, immediately. It runs once per message found by the previous step.
Get the workflow JSON
Open the box below to copy the JSON, or download the file. It contains the 6 nodes above, connected as described, with placeholders for what you sell and who you are, and 7 notes on the canvas, including one called Before you turn it on. It contains none of your logins.
Please read this first: this JSON is free and provided as is. n8n versions and installed nodes differ from one person to another, so it may not run correctly on your side without adjustments. We cannot test it on every setup. That is why this article includes a long section, Problems you may meet and how to fix them. And if you would rather not deal with any of it, you can request a custom workflow and let us handle it.
Click to show or hide the workflow JSON
Click inside the box, select the whole text, copy it, then paste it onto an empty n8n canvas. If selecting is awkward on your device, use the download link above.
{
"name": "AI Email Autoresponder for Leads with n8n (free JSON)",
"nodes": [
{
"id": "46330a1e-99c2-4e0b-b2ef-fbc1ac382402",
"name": "Email Trigger (IMAP)",
"type": "n8n-nodes-base.emailReadImap",
"notes": "Watches one mailbox folder over IMAP and starts the workflow for each new message it picks up.",
"position": [
0,
0
],
"parameters": {
"options": {},
"postProcessAction": "nothing"
},
"notesInFlow": true,
"typeVersion": 2
},
{
"id": "2a2a35ef-23cf-4612-ac7d-21f91f21a2c6",
"name": "Filter",
"type": "n8n-nodes-base.filter",
"notes": "Lets a message continue only if the AI said it is a lead.",
"position": [
608,
0
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "4da59f1a-dd10-450e-a113-d193b63fcdac",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.message.content.lead.toBoolean() }}",
"rightValue": ""
}
]
}
},
"notesInFlow": true,
"typeVersion": 2.2
},
{
"id": "ddba86b4-fe7d-4c36-b42c-6dde939d05f4",
"name": "Get Message",
"type": "n8n-nodes-base.gmail",
"notes": "Searches Gmail for messages from the same sender with the same subject. Each match makes the next step run once.",
"position": [
1216,
0
],
"parameters": {
"filters": {
"q": "=from:\"{{ $('Email Trigger (IMAP)').item.json.from }}\" subject:\"{{ $('Email Trigger (IMAP)').item.json.subject }}\" "
},
"operation": "getAll"
},
"typeVersion": 2.1
},
{
"id": "f1b3f3c5-a2fe-436e-a272-d3958ccab3e5",
"name": "Reply to Message",
"type": "n8n-nodes-base.gmail",
"notes": "Sends the AI text as a reply to the message identified by the original IMAP message id.",
"position": [
1536,
0
],
"parameters": {
"message": "={{ $('Reply with customized message').item.json.message.content }}",
"options": {},
"emailType": "text",
"messageId": "={{ $('Email Trigger (IMAP)').item.json.metadata['message-id'] }}",
"operation": "reply"
},
"notesInFlow": true,
"typeVersion": 2.1
},
{
"id": "2489c348-5d8e-4564-915f-1d933eae745b",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
1456,
-320
],
"parameters": {
"color": 3,
"height": 256,
"content": "## Reply to Message\n\nSends the reply as plain text from the connected Gmail account. The message id it uses comes from the IMAP step. Test that Gmail accepts it."
},
"typeVersion": 1
},
{
"id": "e7617aa6-1104-4cc9-af36-80d7c19cdc59",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-48,
-320
],
"parameters": {
"color": 4,
"width": 208,
"height": 256,
"content": "## Email Trigger (IMAP)\n\nConnect an IMAP credential and choose the folder to watch. Every message it picks up starts one run. Use a test mailbox first."
},
"typeVersion": 1
},
{
"id": "33fe0c88-6540-4087-bb60-ac6c4de9f6d3",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
224,
-320
],
"parameters": {
"color": 7,
"height": 256,
"content": "## Filter leads\n\nThe AI reads the plain-text body and answers with JSON such as {\"lead\": \"true\"}. Replace YOUR_SERVICE_OR_OFFER in the prompt with what you sell. The message text is passed to the AI as it is, so a sender can try to give it instructions."
},
"typeVersion": 1
},
{
"id": "54c5cf98-a106-4e3b-ad2d-d57fb8095044",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
528,
-320
],
"parameters": {
"color": 5,
"height": 256,
"content": "## Filter\n\nOnly messages the AI marked as leads pass. Everything else stops here and gets no reply and no log."
},
"typeVersion": 1
},
{
"id": "94aedcf9-6abb-40e0-9856-e2fc3a84116a",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
832,
-320
],
"parameters": {
"color": 7,
"height": 256,
"content": "## Reply with customized message\n\nThe AI writes the reply. Replace YOUR_BUSINESS_AND_SERVICE, YOUR_NAME, YOUR_COMPANY and YOUR_ONE_LINE_DESCRIPTION in the prompt and in the example. It only knows the email text, so read its output before you trust it."
},
"typeVersion": 1
},
{
"id": "83e57764-c096-45fc-a475-0167caa7eeaf",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1136,
-320
],
"parameters": {
"color": 3,
"width": 256,
"height": 256,
"content": "## Get Message\n\nSearches Gmail by sender and subject. If Gmail finds nothing, or the mailbox you watch is not this Gmail account, nothing reaches the reply step. If it finds several, the reply step runs several times."
},
"typeVersion": 1
},
{
"id": "4875fac3-0ca1-4d26-a116-3afcfe8477c9",
"name": "Filter leads",
"type": "@n8n/n8n-nodes-langchain.openAi",
"notes": "Asks an AI model whether the message looks like a lead for your service. Expected answer: JSON with a lead value of true or false.",
"position": [
240,
0
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"options": {},
"messages": {
"values": [
{
"content": "= Indicate if the following message is a lead that's interested in my YOUR_SERVICE_OR_OFFER\n\nOutput as JSON {\"lead\": \"<true/false>\"}\n\n {{ $json.textPlain }}"
}
]
},
"jsonOutput": true
},
"notesInFlow": true,
"typeVersion": 1.8
},
{
"id": "7c5f6533-c82e-4fa2-b794-c93b38903c7c",
"name": "Reply with customized message",
"type": "@n8n/n8n-nodes-langchain.openAi",
"notes": "Asks an AI model to write the reply from the message text. The reply is sent without review.",
"position": [
848,
0
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"options": {},
"messages": {
"values": [
{
"content": "You're currently monitoring a sales email inbox for YOUR_BUSINESS_AND_SERVICE. For every inquiry you receive, read it and write a short reply tuned to that person. Use plain, no-frills language. Only use facts given here. Never promise a call, a callback, a price, a date or a link, and never invent any. Sign off as YOUR_NAME, YOUR_COMPANY."
},
{
"content": "Hi, I run a small shop and I would like to know how your service works and what the first step is."
},
{
"role": "assistant",
"content": "Hello,\n\nThanks for getting in touch. In short: YOUR_ONE_LINE_DESCRIPTION. The first step is a short message from you describing what you need, and we reply by email with the next step.\n\nBest regards,\nYOUR_NAME, YOUR_COMPANY"
},
{
"content": "={{ $('Email Trigger (IMAP)').item.json.textPlain }}"
}
]
}
},
"notesInFlow": true,
"typeVersion": 1.8
},
{
"id": "7b1e9c24-5d08-4a63-b2f7-3c80d1a46e95",
"name": "Before you turn it on",
"type": "n8n-nodes-base.stickyNote",
"position": [
-48,
-760
],
"parameters": {
"color": 3,
"width": 1600,
"height": 360,
"content": "## Before you turn it on\n\n1. This replies to real people with text written by an AI and nobody reads it first. Use a test mailbox and your own addresses.\n2. There is no check for newsletters, automatic mail, mailing lists or other autoresponders, so two automatic senders can answer each other.\n3. The AI sees the full message text. A sender can write instructions into it.\n4. The AI can promise or invent things. The prompt in this file tells it not to, but check every reply.\n5. If the mailbox you watch is not the connected Gmail account, the search step finds nothing and no reply is sent.\n6. The same message can be answered more than once: the trigger does not mark mail as read, and the search step can match several messages.\n7. Sender names and message text go to the AI service and to Gmail.\n8. Not tested on live APIs."
},
"typeVersion": 1
}
],
"connections": {
"Filter": {
"main": [
[
{
"node": "Reply with customized message",
"type": "main",
"index": 0
}
]
]
},
"Get Message": {
"main": [
[
{
"node": "Reply to Message",
"type": "main",
"index": 0
}
]
]
},
"Filter leads": {
"main": [
[
{
"node": "Filter",
"type": "main",
"index": 0
}
]
]
},
"Email Trigger (IMAP)": {
"main": [
[
{
"node": "Filter leads",
"type": "main",
"index": 0
}
]
]
},
"Reply with customized message": {
"main": [
[
{
"node": "Get Message",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
}
}
Install it in ten steps
- Prepare a test mailbox with IMAP switched on.
- Get the JSON from the box above or the download link.
- Import it. Open a new empty workflow in n8n, then paste the JSON onto the canvas or import it from a file.
- Check the 6 nodes appear, with 7 notes and no missing-node warning.
- Connect the IMAP credential in Email Trigger (IMAP) and choose the folder.
- Connect OpenAI in both AI nodes.
- Connect Gmail in Get Message and Reply to Message.
- Replace the placeholders in the two prompts and in the example.
- Send your test emails and use the node’s execute button to run one step at a time, reading what each node outputs.
- Turn it on only when every test behaves, and watch the first real days.
Auto-replying to spam and phishing: how to spot a phishing email first
An autoresponder that answers everything the AI likes will sooner or later answer a scam. Replying to a phishing email confirms that your address is live and read, and a reply that quotes the scammer’s message can carry details you did not mean to share. The AI lead check does not look for fraud; it looks for interest in your service, and a scam can be written to sound exactly like interest.
Before you trust any automatic reply, learn how to spot a phishing email. Common signs include:
- Pressure. Urgent deadlines, threats or “act now” language.
- A sender that does not match. A display name that looks right but an address from a different or oddly spelled domain.
- Requests for secrets or money. Passwords, codes, payment details, gift cards or a changed bank account.
- Unexpected links and attachments. Especially ones you did not ask for.
- Generic greetings, or details that do not fit what you know about the sender.
None of these is proof by itself, and a clean-looking email can still be a scam. If you add a safeguard, a sensible one is to have the workflow draft the reply for a person to approve, and to refuse to reply to senders you do not know, automatic senders and anything that asks for money or secrets. We did not build that into the file.
What it will not do: limits, costs and trade-offs
- No human review before a reply is sent.
- No log. It does not record who wrote, what the AI decided or what was sent.
- No sender checks. No allow list, no block list, no check for automatic mail or mailing lists.
- No duplicate protection. The same message or sender can be answered more than once.
- No error alerts. A failed step ends the run for that email, and nothing tells you.
- No memory. A conversation with the same person is not remembered between emails.
- One short prompt of instructions, and nothing that knows your prices, hours or policies.
- It needs n8n running all the time, and a mailbox that allows IMAP.
Access, privacy and responsible use
This workflow reads private email, sends the text of it to outside services, and writes to people in your name.
- Know where email content goes. The text of each incoming email goes to OpenAI, and the sender and subject go to Gmail. Read their terms, and tell people where their data goes if the rules that apply to you require it. Do not point this at a mailbox that holds confidential or sensitive messages.
- Do not let an AI make promises. A reply can create expectations about price, timing or a call. Our prompt tells the AI not to, but only you can check what it actually writes.
- Be clear about who answers. Some places and some customers expect to know when an automatic system replied. Consider saying so in the reply.
- Use a dedicated mailbox and the smallest access. Use an app password where your provider offers one, not your main password.
- Guard against injected instructions. Treat every email as untrusted text, review replies, and do not connect this AI to tools or data it should not reveal.
- Rules on automated email and personal data differ by country. We are not lawyers, and nothing here is legal advice or a statement that this workflow complies with any law. Our article on cold email compliance for small teams explains the US side in more depth.
Problems you may meet and how to fix them
Every n8n setup is different, so this workflow can behave differently for you than in our checks. Here are the most likely problems. For each one: what you see, why it happens, and what to do. They come from how the nodes are built and from reading the file, not from a live run with real accounts.
1. The workflow imports, but a node shows as unknown or has a warning
What you see: a red or grey node after import.
Why: your n8n version may not have the same node versions as the one the template was made on, especially for the AI and email nodes.
Fix: update n8n, or replace the node with the same kind of node from your own node menu and copy its settings across.
2. The IMAP trigger will not connect
What you see: a connection or login error on Email Trigger (IMAP).
Why: IMAP is switched off in the mailbox, the server address or port is wrong, or your provider needs an app password or blocks the login.
Fix: check the provider’s IMAP settings, switch IMAP on, and use an app password if offered.
3. Nothing happens when a test email arrives
What you see: the workflow does not start.
Why: the workflow is not turned on, the wrong folder is watched, or the trigger only listens while the workflow is active.
Fix: set the folder, then turn the workflow on, or run the trigger by hand with the listen button in the editor, and send a new test email.
4. The same emails are handled again after a restart
What you see: people get a second reply to an old message.
Why: the trigger is set to leave messages untouched, and your n8n may treat unread mail as new each time the workflow starts. We could not confirm this.
Fix: test with a few old messages. If it repeats, use the trigger’s option to mark messages as read after processing, and keep a record of answered messages.
5. The AI node fails with a key or model error
What you see: an error in Filter leads or Reply with customized message.
Why: the OpenAI credential is missing or wrong, or your account has no access to the GPT-4o model.
Fix: check the credential and the model list in the node, and pick a model your account can use.
6. The lead check returns something other than true or false
What you see: the filter fails, or everything passes, or nothing does.
Why: the AI answered in another form, such as a real true, a sentence, or the text of the template itself. The conversion to yes or no then does not behave as expected. We did not confirm how it handles each case.
Fix: run Filter leads on a few test emails and read its output. Make the instruction stricter, or replace the filter with a plain comparison against the text “true”.
7. Almost nothing is classified as a lead, or everything is
What you see: too few or too many replies.
Why: the instruction is one sentence. If you left the placeholder, the AI does not know what you sell.
Fix: replace YOUR_SERVICE_OR_OFFER, and describe in a few lines who counts as a lead and who does not. Test with real examples of both.
8. Newsletters, notifications or spam get an answer
What you see: your system answers mail that no human wrote.
Why: the only test is the AI’s yes or no, and an automatic message can look like interest.
Fix: add a step before the AI that stops mail from automatic senders, mailing lists and addresses you do not want to answer, and keep a list of senders you know.
9. Two automatic systems answer each other
What you see: a long chain of replies between your mailbox and another autoresponder.
Why: there is no check on whether the sender is a person, and no limit on replies per sender.
Fix: allow only one reply per sender in a period, and stop when a message looks automatic. Test this on purpose with a second mailbox before you go live.
10. A sender gets the AI to say something it should not
What you see: a reply that follows instructions written in the incoming email, or reveals the instructions.
Why: the email text is placed directly in the prompt.
Fix: review replies before sending, add a strict rule in the prompt, and never give this AI access to private data.
11. The reply promises a call, a price or a date
What you see: an email that says someone will phone, or quotes something you never decided.
Why: an AI follows the pattern of the example it was given and invents what it does not know. We replaced the original example, but the model can still make things up.
Fix: keep the rules in the prompt, add real facts you do want it to use, and read every reply during the first weeks.
12. The reply sounds generic or repeats the example
What you see: answers that copy the example’s wording.
Why: a single example strongly shapes the style.
Fix: rewrite the example in your own voice, or add a second, different one.
13. The reply is in the wrong language
What you see: an English reply to a message in another language.
Why: the prompt does not say which language to use.
Fix: add a line telling the AI which language to reply in, or to answer in the language of the incoming email.
14. The AI reads an empty message
What you see: a strange classification or reply for emails that are mostly images or formatted newsletters.
Why: the AI receives the plain-text part, which can be empty when the message only has an HTML part.
Fix: test with an HTML-only email. If the text is empty, stop the run there, or use the HTML part after converting it to text.
15. Nothing is sent, and there is no error
What you see: the lead check passes, the AI writes a reply, and no email leaves.
Why: the Gmail search found no message. This happens when the mailbox you watch is not the connected Gmail account, when the sender or subject text breaks the search, or when Gmail does not yet have the message.
Fix: watch the same Gmail account over IMAP, or remove the search step and build the reply from the original email data. Read the output of Get Message in a test.
16. The reply goes out several times
What you see: the same person receives two or three identical replies.
Why: the search returns several matching messages, such as earlier emails with the same subject, and the reply step runs once for each.
Fix: limit the search to one result, or add a step that reduces the results to a single item before the reply.
17. The reply step fails with a message error
What you see: an error in Reply to Message about a message that cannot be found.
Why: the step is given the IMAP message-id, and Gmail’s reply works with Gmail’s own message code. We believe they differ but could not confirm it.
Fix: use the id in the search step’s output for the reply step, and test again.
18. The reply is not in the same conversation
What you see: the answer arrives as a new thread.
Why: the reply is attached to a message id that does not match, or the subject was changed.
Fix: fix the id as above, and compare the thread in Gmail.
19. The reply has no signature and no formatting
What you see: a bare text reply.
Why: it is sent as plain text, with whatever the AI wrote.
Fix: add your signature in the prompt, or switch the email type and write HTML, after testing how your mail client shows it.
20. The Gmail node adds a line you did not write
What you see: a sentence about n8n at the bottom of the replies.
Why: some versions of the node add an attribution by default.
Fix: open the Gmail node options and look for an attribution setting. Read a test email before you send real ones.
21. A real prospect is missed
What you see: someone who wanted to buy got no reply, and you cannot tell why.
Why: the AI said no, or a step failed, and nothing was logged.
Fix: add a log of every classification, and check your inbox regularly. An autoresponder does not replace reading your mail.
22. The Gmail account is limited or blocked
What you see: Google warns about unusual activity, or sending stops.
Why: too many automatic messages in a short time, or a flood of mail to answer.
Fix: keep volumes small, add a pause and a daily limit, and use an account you can afford to have restricted.
23. Costs rise unexpectedly
What you see: a larger bill from the AI service.
Why: every incoming message uses an AI call, including spam and long newsletters.
Fix: filter obvious automatic mail before the AI, and set a spending limit in your AI account.
24. The workflow stops running
What you see: new emails are no longer picked up.
Why: n8n restarted or lost its connection to the mailbox, or the IMAP login stopped working.
Fix: check that the workflow is still active and that the credential works, and set up a way to be alerted when n8n is down.
25. Everything imports but the JSON does not behave as described
What you see: something this guide describes does not match what you see.
Why: versions differ, and we did not run this exact file in n8n.
Fix: test each step in your own n8n with the execute button, look at what each node outputs, and if you get stuck, request a custom workflow.
Too much of a puzzle? Let us build or adapt it for you
Some people enjoy tinkering with n8n. Others want an autoresponder that is safe to leave on. If you are in the second group, LeenLabs builds and adapts n8n workflows for people like you. We can:
- Add a human approval step so replies are drafted and you press send.
- Filter out automatic senders, mailing lists and unknown domains.
- Stop duplicate and looping replies with a limit per sender.
- Log every decision in a sheet, so nothing disappears silently.
- Fix the reply step so it uses the right message and the right thread.
- Add your real facts (services, hours, policies) to the prompt, with strict rules.
- Connect your CRM or a sheet to record each lead.
- Build a new workflow from scratch for another task you want to automate.
We do not run an email lead generation agency and we do not answer your email for you. We build the automation, and you stay in charge of what is said and to whom.
Request a Custom Workflow, describe what you want to automate, and we will come back to you with the next steps. Prefer to ask a question first? Write to support@leenlabs.site.
What we changed in the original template
We want you to know exactly how this file differs from the template it comes from. Compared with the file we received, LeenLabs made these changes:
- Removed internal data. We removed the template’s identifier, its setup-status marker, the inactive flag, saved test data, the connection identifiers and the webhook identifiers, and renamed the workflow to this article’s title.
- Replaced the bracketed placeholders in the prompts with
YOUR_SERVICE_OR_OFFERandYOUR_BUSINESS_AND_SERVICE. - Replaced the instructions and the example conversation in Reply with customized message. The original example named a person, a monthly commitment and a high-ticket offer, was signed with the author’s names, and said that a team member would phone within a couple of minutes. The new example is neutral and contains no promise. We also added rules to the instructions: use only the facts given, never promise or invent a call, price, date or link, and sign with your own name and company. This changes what the AI is told, and we did not test its effect.
- Rewrote the six canvas notes and the node notes. The originals contained links to documentation and descriptions that did not match what the nodes do. We replaced them with plain explanations of what each step really does, and stated that the file was not tested on live services.
- Added a note called Before you turn it on with the main warnings.
The nodes, their settings, the conditions, the connections and the structure of the Gmail search are otherwise unchanged. That includes the defects described above, which we documented rather than fixed.
What was verified, and what was not
Here is exactly what we did. This template has no Code node, so there was no code to run. We checked the structure of the file: six working nodes, correct connections, no logins, no internal identifiers and no author names. We built the Gmail search text on two simulated emails and listed how many replies go out when the search finds none, one or three messages.
We did not import this exact file into n8n and run it end to end. We did not connect an IMAP mailbox, OpenAI or Gmail, so we cannot confirm what the AI returns, how the filter converts it, how the IMAP trigger treats messages it has already seen, whether Gmail accepts the IMAP message-id in the reply step, or how Gmail reads the search text for unusual subjects. That is why we recommend a full test with your own addresses before you turn it on.
Five ways to adapt the workflow
- Add an approval step. Save the AI reply as a Gmail draft or send it to yourself, and send it only after you read it.
- Filter before the AI. Stop mailing lists, automatic mail and known addresses before any AI call.
- Add a log. Write each message, the lead decision and the reply to a Google Sheet.
- Use another AI service. Replace the two OpenAI nodes with another model node.
- Add your facts. Put your opening hours, services and rules in the prompt, so the AI does not guess.
These variations are suggestions based on how n8n works, not changes we tested on this template. If you want one built for you, send us a request.
Frequently asked questions
What is an AI email autoresponder?
Software that answers incoming email by itself, with text written by an AI model instead of a fixed template. This workflow is a small example: it classifies each message and writes a reply for the ones it calls leads.
Does it find email leads, or work as a cold email lead sourcing tool?
No. It only reacts to emails that people send you. It does not search for contacts, research email addresses or send first messages. For sending, see our outbound outreach workflow in the suggested reading below.
Is this lead scoring?
No. It makes one yes or no decision per email and keeps no points, history or ranking.
Is it a tool for email marketing or B2B lead generation?
No. It is an inbound reply helper for one mailbox. Email marketing and B2B lead generation usually mean campaigns to many contacts, which need a list, consent and unsubscribe handling that this template does not have.
Can an agency or a tool do this for me?
Yes, there are products and agencies that handle email for businesses, and we have not tested or compared any, so we do not rank them. LeenLabs is not an email agency. We build and adapt n8n workflows, and you can request a custom workflow.
Will it reply to phishing and spam?
It can. It has no fraud check, only an AI judgment about interest. See the section above on how to spot a phishing email, and add filters and an approval step.
Do I need Gmail?
The reply and the search steps use Gmail. The trigger reads any mailbox with IMAP. For the workflow to make sense, watch the same Gmail account, or change the last two steps to your own email provider.
Can the sender manipulate the AI?
Yes, it is possible. The email text goes straight into the prompt. Review replies and keep sensitive data away from this AI.
Where does email data go?
To OpenAI and Gmail. Read their terms.
Is the workflow free?
The file is free. The services it connects have their own plans, limits and prices.
What if the JSON does not work on my n8n?
It can happen, because setups differ. Go through the problems section above. If it still does not work, or you do not want to spend the time, request a custom workflow and we will handle it.
Who built the original template?
The original template comes from the n8n Library at n8n.io. LeenLabs adjusted and documented it.
Tools used in this workflow
The links below go to each tool’s home page, and some may be affiliate links, as explained in our Terms of Service.
- n8n (may be an affiliate link): the automation platform that runs the workflow, available hosted or self-hosted.
- OpenAI (may be an affiliate link): the AI service that provides GPT-4o.
- Gmail (may be an affiliate link): the email service that finds the message and sends the reply.
Suggested reading
If email and leads are your focus, these LeenLabs articles go well with this one:
- AI Email Automation with n8n: Outbound Outreach: the sending side, with a follow-up and a reply check, and its own list of risks.
- Send Escalating Overdue Invoice Reminders with n8n: another Gmail workflow that sends messages on a schedule, with a different job.
- Cold Email Compliance for Small Teams: CAN-SPAM, 2026 Rules: a deeper business article on what the law asks of senders.
- AI Cold Email That Doesn’t Sound Like AI: Research Workflow: a deeper business article on writing better AI emails.
Keep exploring
Browse more free n8n workflows from LeenLabs.
Need this adapted to your own setup?
Tell us what you want to automate and we will come back to you with the next steps.