This workflow follows the Emailreadimap → HTTP Request recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "AI Email Auto-Responder (Ollama)",
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "minutes",
"minutesInterval": 5
}
]
}
},
"id": "schedule",
"name": "Check Every 5 Minutes",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
240,
300
]
},
{
"parameters": {
"operation": "getAll",
"returnAll": false,
"limit": 10,
"filters": {
"readStatus": "unread"
}
},
"id": "get-emails",
"name": "Get Unread Emails (IMAP)",
"type": "n8n-nodes-base.emailReadImap",
"typeVersion": 2,
"position": [
460,
300
],
"credentials": {
"imap": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"url": "http://localhost:11434/api/generate",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ model: 'llama3:8b', prompt: 'Classify this email into one of these categories: URGENT, QUESTION, FEEDBACK, SPAM, OTHER.\\n\\nFrom: ' + $json.from + '\\nSubject: ' + $json.subject + '\\nBody: ' + ($json.text || '').substring(0, 1000) + '\\n\\nRespond with ONLY the category name, nothing else.', stream: false, options: { temperature: 0.1, num_predict: 20 } }) }}",
"options": {
"timeout": 60000
}
},
"id": "classify",
"name": "1. Classify Email (Ollama)",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
680,
300
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": false
},
"combinator": "or",
"conditions": [
{
"leftValue": "={{ JSON.parse($json.data).response.trim() }}",
"rightValue": "SPAM",
"operator": {
"type": "string",
"operation": "equals"
}
}
]
}
},
"id": "filter-spam",
"name": "Filter Spam",
"type": "n8n-nodes-base.filter",
"typeVersion": 2,
"position": [
900,
300
]
},
{
"parameters": {
"url": "http://localhost:11434/api/generate",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ model: 'llama3:8b', prompt: 'Write a professional, helpful email reply to this message. Be concise and friendly.\\n\\nFrom: ' + $('Get Unread Emails (IMAP)').item.json.from + '\\nSubject: ' + $('Get Unread Emails (IMAP)').item.json.subject + '\\nBody: ' + ($('Get Unread Emails (IMAP)').item.json.text || '').substring(0, 2000) + '\\n\\nWrite ONLY the reply body (no subject line, no greeting format instructions). Sign off as the team.', stream: false, options: { temperature: 0.5, num_predict: 1000 } }) }}",
"options": {
"timeout": 120000
}
},
"id": "draft-reply",
"name": "2. Draft Reply (Ollama)",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1120,
300
]
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "draft",
"name": "draft_reply",
"value": "={{ JSON.parse($json.data).response }}",
"type": "string"
},
{
"id": "original_from",
"name": "original_from",
"value": "={{ $('Get Unread Emails (IMAP)').item.json.from }}",
"type": "string"
},
{
"id": "original_subject",
"name": "original_subject",
"value": "={{ 'Re: ' + $('Get Unread Emails (IMAP)').item.json.subject }}",
"type": "string"
},
{
"id": "category",
"name": "category",
"value": "={{ JSON.parse($('1. Classify Email (Ollama)').item.json.data).response.trim() }}",
"type": "string"
}
]
}
},
"id": "prepare-output",
"name": "Prepare Draft for Review",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
1340,
300
]
}
],
"connections": {
"Check Every 5 Minutes": {
"main": [
[
{
"node": "Get Unread Emails (IMAP)",
"type": "main",
"index": 0
}
]
]
},
"Get Unread Emails (IMAP)": {
"main": [
[
{
"node": "1. Classify Email (Ollama)",
"type": "main",
"index": 0
}
]
]
},
"1. Classify Email (Ollama)": {
"main": [
[
{
"node": "Filter Spam",
"type": "main",
"index": 0
}
]
]
},
"Filter Spam": {
"main": [
[
{
"node": "2. Draft Reply (Ollama)",
"type": "main",
"index": 0
}
]
]
},
"2. Draft Reply (Ollama)": {
"main": [
[
{
"node": "Prepare Draft for Review",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"tags": [
{
"name": "AI"
},
{
"name": "Ollama"
},
{
"name": "Email"
},
{
"name": "Automation"
}
]
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
imap
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
AI Email Auto-Responder (Ollama). Uses emailReadImap, httpRequest. Scheduled trigger; 6 nodes.
Source: https://github.com/bonskari/n8n-ai-workflows/blob/main/download/ai-email-responder.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Send Google Analytics Data To A I To Analyze Then Save Results In Baserow. Uses scheduleTrigger, manualTrigger, stickyNote, googleAnalytics. Scheduled trigger; 22 nodes.
Push Your Public Ip To Namecheaps Dynamic Dns. Uses httpRequest. Scheduled trigger; 7 nodes.
Send Updates About The Position Of The Iss Every Minute To A Topic In Kafka. Uses httpRequest, kafka. Scheduled trigger; 4 nodes.
Send Http Requests To A List Of Urls. Uses splitOut, scheduleTrigger, httpRequest. Scheduled trigger; 4 nodes.
Send Updates About The Position Of The Iss Every Minute To A Topic In Rabbitmq. Uses rabbitmq, httpRequest. Scheduled trigger; 4 nodes.