Automate Email Replies with n8n’s IMAP and AI Integration

Struggling with managing overflowing inboxes and crafting timely email responses? This n8n workflow automates reading emails via IMAP, summarizes content with AI, drafts replies, and waits for human approval before sending, saving hours of manual work.
emailReadImap
chainSummarization
emailSend
+4
Workflow Identifier: 1644
NODES in Use: EmailReadImap, Markdown, chainSummarization, agent, lmChatOpenAi, emailSend, if
Automate email replies with n8n and IMAP

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

Learn how to Build this Workflow with AI:

What this workflow does

This workflow reads new emails from an inbox using IMAP.

It makes a short summary of each email using AI.

Then it writes a clear and professional reply draft.

Users get a message asking to approve the reply.

Once approved, the reply sends automatically back to the sender.

This helps save time handling many emails and keeps control over messages sent.


Who should use this workflow

This is good for small business people or anyone with many customer emails.

People who want to reply fast but want to check answers first will find it useful.

No heavy tech skills needed, but some experience with n8n helps.


Tools and services used


Inputs, processing, and output

Inputs

  • New emails arrive in an IMAP inbox.

Processing steps

Output


Beginner step-by-step: How to use this workflow in n8n production

Step 1: Import the workflow

  1. Download the workflow file using the Download button on this page.
  2. Go to the n8n editor (either cloud or self-host n8n).
  3. Use the Import from File option to load the workflow into n8n.

Step 2: Add your credentials

  1. In n8n, open the IMAP email trigger node, enter your IMAP email server details with username and password.
  2. Open the SMTP sending node and enter your SMTP server credentials, verified from your email provider.
  3. Add your OpenAI API key in the LangChain nodes used for summarization and reply generation.

Step 3: Update workflow settings if needed

  1. Change the approval email address to your own mailbox, e.g., [email protected].
  2. Check and update email folder names or IDs if you use custom folders.

Step 4: Test the workflow

  1. Send a test email to the configured inbox.
  2. Run the workflow manually in n8n to check if it triggers and processes the email.
  3. Make sure the approval email arrives in the approval mailbox with the AI draft.
  4. Reply with approval (like a “Yes”) to trigger the sending of the reply email.

Step 5: Activate the workflow

  1. Once tests are successful, switch the workflow to active to run automatically.
  2. Monitor workflow executions in the dashboard for errors or successes.

Step-by-step workflow explanation

Step 1: Email input via IMAP trigger node

Workflow starts when a new email arrives in the monitored IMAP inbox.

IMAP node fetches emails continuously and triggers the following steps.

Step 2: Convert email HTML to Markdown

The email body in HTML is converted to Markdown format.

This helps AI models read the email text clearly without HTML markup noise.

Step 3: Summarize email content

An AI call uses OpenAI with a prompt to write a summary in max 100 words.

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

"{{ $json.data }}"

Do not enter the total number of words used.

This produces a short and easy to understand summary of the email.

Step 4: Generate reply using LangChain agent

The AI writes a professional reply based on the summary, also max 100 words.

=Write the text to reply to the following email:

{{ $json.response.text }}

This reply text is business-appropriate and keeps it short to save time.

Step 5: Save generated reply text

A Set node stores the reply text into a variable called email.

This ensures the text is easy to access in later nodes for sending or reviewing.

Step 6: Request human approval

An email is sent to a specified approval inbox with the original message and AI reply draft.

The subject is prefixed with “[Approval Required]” to catch attention.

Step 7: Wait for approval decision

The workflow checks a boolean flag data.approved from the approval reply.

Only if true, the workflow continues to sending the reply.

Step 8: Send approved reply email

The email reply sends to the original sender using SMTP server credentials.

Subject line stays the same for conversation context.


Common problems and fixes

  • Workflow does not start on new emails: Check IMAP credentials carefully and test connection outside n8n if possible.
  • AI replies are missing or strange: Make sure the Markdown node outputs to the summarization correctly and API keys for AI are valid.
  • Emails do not send after approval: Review SMTP node settings and confirm email addresses and fromEmail fields match verified senders.

Customization ideas

  • Change the approval email subject prefix to any text by editing the approval email node.
  • Choose different OpenAI models in LangChain to adjust tone or length of replies.
  • Add filters to auto-respond to simple questions without approval to save time.
  • Connect Slack or Microsoft Teams to get notified when an approval is waiting.

Summary

✓ Saves hours weekly by automating email reading and replying.

✓ Keeps humans in control with approval before sending.

→ Turns long, complex customer emails into quick summaries.

→ Creates clear, professional reply drafts ready to send.

→ Integrates easily with existing email accounts and OpenAI AI models.

✓ Helps reduce errors and missed emails.

Automate email replies with n8n and IMAP

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

Yes. The workflow can use Gmail nodes in n8n to replace the Email Read IMAP node for Gmail accounts.
Yes. Each email summary and reply generation uses OpenAI API credits. Users should monitor usage.
Check IMAP server settings, credentials, username, and password. Test connection independently to fix trigger issues.
Yes. Credentials are stored securely in n8n. Using IMAP over SSL/TLS is recommended to protect data.

Promoted by BULDRR AI

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.