Automate Email Replies with n8n, AI & IMAP Human-in-Loop

This n8n workflow automates email reading via IMAP, uses advanced AI to summarize and draft responses, and incorporates a human approval step before sending replies. It solves time-consuming email management with professional, concise answers and quality control.
emailReadImap
chainSummarization
agent
+5
Workflow Identifier: 2234
NODES in Use: EmailReadImap, Markdown, EmailSend, LangChainSummarizationChain, LangChainAgent, LMChatOpenAi, Set, If
Automate email replies with n8n and AI

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

1. What This Workflow Does

This workflow reads new emails from an IMAP inbox, makes a short summary of the email using AI, writes a professional reply draft, and sends it to a human to approve before sending it back to the sender.

The main problem solved is saving time and reducing mistakes when replying to many business emails.

After running, the user gets quick, accurate email replies with human review to stop errors.


2. Inputs → Processing → Output

Inputs

  • IMAP Email Account: Incoming emails monitored and fetched.
  • SMTP Email Account: Used to send approval requests and final replies.
  • OpenAI API: Runs AI models for summarizing and writing email drafts.

Processing Steps

  • Email Trigger (IMAP): Watches inbox for new emails.
  • Markdown Node: Converts email HTML content into Markdown text for AI.
  • Email Summarization Chain: Uses AI to make a short summary, max 100 words.
  • Write email AI Agent: Creates concise professional reply based on summary.
  • Set Email text Node: Saves AI reply for sending.
  • Approve Email Node: Emails draft reply plus original message to a human reviewer.
  • Approval IF Node: Checks if human approved reply.
  • Send Email Node: Sends approved reply to original sender, keeping headers.

Output

Final, approved reply emails sent to original senders.


3. Who Can Use This Workflow

This workflow helps people who get many business emails and want to save time.

Users should have an email account with IMAP access and some knowledge of n8n.

Good for customer support teams, sales reps, or small businesses.


4. Tools and Services Used

  • n8n Automation: Runs the workflow nodes.
  • IMAP Email Server: Receives new emails to process.
  • SMTP Email Server: Sends emails for approval and replies.
  • OpenAI GPT-4 API: Creates email summaries and replies.
  • LangChain Nodes: Manages AI summarization steps.

5. Beginner Step-by-step: How to Use This Workflow in n8n

Step 1: Import the Workflow

  1. Download the workflow by clicking the Download button on this page.
  2. In the n8n editor, click Import from File and upload the downloaded workflow.

Step 2: Configure Credentials

  1. Add your IMAP email credentials under Credentials > IMAP Email.
  2. Add your SMTP email credentials under Credentials > SMTP Email.
  3. Add your OpenAI API Key in the OpenAI or OpenAI Chat Model nodes.

Step 3: Update Settings

  1. Change email addresses, folders, or IDs if the workflow uses example values.
  2. Check any prompt or code values under the LangChain summarization or AI reply nodes.

Step 4: Test the Workflow

  1. Send a test email to your IMAP inbox.
  2. Run the workflow manually or wait for the trigger.
  3. Confirm the AI summary and draft appear in the approval email.
  4. Approve or reject the draft and see the final email sent or stopped.

Step 5: Activate for Production

  1. Turn the workflow ON in n8n.
  2. Keep n8n running with network access to email servers and OpenAI.
  3. Monitor workflow logs for errors.

For users running n8n on their own server, see this helpful link for self-host n8n.


6. Common Problems and Fixes

  • No New Emails: Check IMAP credentials and monitored folders.
  • Emails Not Sending: Verify SMTP credentials and app passwords.
  • AI Replies Empty: Check Markdown conversion and refine AI prompts.

7. Customization Ideas

  • Change AI model in OpenAI nodes for different reply style.
  • Adjust summarization prompt to focus on dates or action items.
  • Add auto-decline handling like notifications or logs.
  • Add Slack alerts when emails wait for approval.
  • Make copies to monitor several inboxes in parallel.

8. Final Summary

✓ Saves hours by automating email reading and drafting.

✓ Keeps human review to reduce reply mistakes.

✓ Easy to set up using standard IMAP, SMTP, and OpenAI keys.

→ Sends professional replies faster and more accurately.


9. Useful Prompt Example for Summarization

Use this exact prompt in the Email Summarization Chain node to limit to 100 words:

Write a concise summary of the following in max 100 words:

"{{ $json.data }}"

Do not enter the total number of words used.

10. Example Expression to Convert Email HTML to Markdown

Use this expression in the Markdown node html field:

{{$json.textHtml}}

11. Sample AI Reply Instruction

Set the AI agent system message to:

Write a professional email reply in max 100 words based on the summary.
Do not create a subject line; only write the email body.
Keep it short, clear, and polite.

Automate email replies with n8n and AI

Visit through Desktop to Interact with the Workflow.

Author
Written By
Vikash Kumar
Building AI agents, n8n workflows and end-to-end automation for 30+ Brands across India, the US, Europe, Dubai & Australia. 7+ years of Experience saving founders real hours every week - no code required.
Author
Written By
Vikash Kumar
Building AI agents, n8n workflows and end-to-end automation for 30+ Brands across India, the US, Europe, Dubai & Australia. 7+ years of Experience saving founders real hours every week - no code required.

Frequently Asked Questions

Yes, any email provider that supports IMAP can be used by entering the proper IMAP credentials in the workflow.
Using OpenAI models in the workflow incurs API usage fees based on tokens processed, so monitor the usage on your OpenAI account.
The workflow stops sending the reply. You can customize it to send a notification or log the declined message.
Emails and AI data pass through the n8n environment, so secure the n8n server and credentials properly to protect sensitive information.

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.