Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

n8n-nodes-imap-ai

terschawebIT0MIT1.1.24TypeScript support: included

AI-Agent ready IMAP node for n8n with enhanced $fromAI() integration and AI Tool support. Complete email and mailbox management with intelligent automation capabilities.

n8n-community-node-package, imap, email, ai-agent, ai-tool, automation, mailbox, ai-ready, fromAI, tool-support

readme

🤖 n8n-nodes-imap-ai

AI-Agent Ready IMAP Node for n8n with Enhanced Automation Capabilities & AI Tool Support

This is an advanced, AI-agent optimized IMAP node for n8n that provides comprehensive email and mailbox management with intelligent $fromAI() integration and full AI Tool support for n8n AI Agents.

🙏 Built upon the excellent foundation of n8n-nodes-imap by Vasily Maslyukov

🌟 Features

🤖 NEW: AI Tool Support

Full compatibility with n8n AI Agents as intelligent tools!

  • usableAsTool: true - Automatically available as AI Agent Tool
  • aiEnabled: true - Enhanced AI integration
  • Two Node Variants:
    • IMAP AI: Classic node with $fromAI() support
    • IMAP Tool: Optimized for AI Agent tool usage
  • Intelligent Parameter Descriptions: AI-friendly field explanations for tool usage
  • Auto-Discovery: AI Agents can automatically discover and use IMAP operations

✅ Complete Email Operations (7 AI-Ready Operations)

  • EmailGetList: Intelligent email search with AI-generated queries
  • EmailSetFlags: AI-driven flag management with bulk operations
  • EmailMove: Smart email organization and routing
  • EmailDownload: AI-controlled email archiving with flexible output
  • EmailCopy: Intelligent email duplication and backup
  • EmailDownloadAttachment: Automatic attachment management
  • EmailCreateDraft: AI-based draft creation with intelligent content

✅ Complete Mailbox Operations (8 AI-Ready Operations)

  • MailboxCreate: Intelligent folder creation with AI parameters
  • MailboxDelete: AI-safe deletion with mandatory confirmation
  • MailboxGetList: Enhanced folder analysis with statistics
  • MailboxGetQuota: Intelligent storage monitoring with analytics
  • MailboxGetStatus: Advanced folder monitoring with activity metrics
  • MailboxRename: AI-driven folder standardization
  • MailboxSubscribe: Intelligent folder visibility management
  • MailboxMove: Advanced folder reorganization and hierarchy restructuring

🚀 AI-Agent Integration

🔧 Using as AI Tool

AI Agents can automatically discover and use the IMAP Tool node for:

  • 📧 Automated Email Processing: AI agents can read, search, and organize emails
  • 🗂️ Intelligent Folder Management: Create, rename, and organize mailbox folders
  • 🔍 Smart Email Search: AI-driven email discovery and filtering
  • 📋 Email Analytics: Get mailbox statistics and quota information
  • 🏷️ Flag Management: Automatically mark emails as read, important, etc.

Example AI Agent Usage:

AI Agent: "Check my inbox for urgent emails from the last 24 hours"
→ Uses IMAP Tool with EmailGetList operation
→ Automatically applies search criteria and time filters
→ Returns structured email data for further processing

💡 Traditional $fromAI() Integration

Every operation includes $fromAI() integration for manual AI-agent automation:

// Example: AI-driven email search
{
  "searchQuery": "={{ $fromAI('search_query', 'Email search criteria') }}",
  "mailboxPath": "={{ $fromAI('target_folder', 'Mailbox to search in') }}"
}

Enhanced Features for AI Workflows:

  • Intelligent Parameter Descriptions: AI-friendly field explanations
  • Enhanced Metadata: Rich response data for AI decision-making
  • Safety Mechanisms: Confirmation requirements for destructive operations
  • Bulk Operations: Efficient mass email processing
  • Error Handling: Clear error messages for AI debugging

📦 Installation

Via n8n Community Nodes

  1. Open your n8n instance
  2. Go to SettingsCommunity Nodes
  3. Install: n8n-nodes-imap-ai
  4. Restart n8n

Via npm

npm install n8n-nodes-imap-ai

🔧 Configuration

  1. Create IMAP Credentials:

    • Host: Your IMAP server (e.g., imap.gmail.com)
    • Port: Usually 993 for SSL
    • Username: Your email address
    • Password: Your email password or app-specific password
    • SSL: Enable for secure connection
  2. Use in Workflows:

    • Add "IMAP AI" node to your workflow
    • Select your IMAP credentials
    • Choose operation (Email or Mailbox)
    • Configure AI-enhanced parameters

🤖 AI-Agent Examples

Smart Email Organization

// AI automatically categorizes and moves emails
{
  "operation": "move",
  "emailIds": "={{ $fromAI('email_ids', 'IDs of emails to organize') }}",
  "targetFolder": "={{ $fromAI('target_folder', 'Destination folder based on email content') }}"
}

Intelligent Folder Management

// AI creates folders based on email patterns
{
  "operation": "createMailbox",
  "mailboxName": "={{ $fromAI('folder_name', 'Folder name based on email categorization') }}",
  "topLevelMailbox": "={{ $fromAI('is_top_level', 'Whether to create as top-level folder') }}"
}

Automated Cleanup

// AI identifies and archives old emails
{
  "operation": "downloadAndArchive", 
  "searchCriteria": "={{ $fromAI('cleanup_criteria', 'Criteria for emails to archive') }}",
  "outputFormat": "eml"
}

📊 Use Cases

  • Email Automation: Automated email processing and routing
  • Content Analysis: AI-driven email categorization and insights
  • Backup & Archiving: Intelligent email backup strategies
  • Cleanup Operations: Smart mailbox maintenance and organization
  • Integration Workflows: Connect email data with other systems

🛡️ Security Features

  • Safe Deletion: Mandatory confirmation for destructive operations
  • Credential Protection: Secure IMAP authentication
  • Error Handling: Comprehensive error reporting
  • Audit Trail: Enhanced logging for operations

🙏 Acknowledgments

This project is built upon the excellent foundation of the original n8n-nodes-imap by Vasily Maslyukov.

What's New in the AI-Enhanced Version:

  • ✅ Complete $fromAI() integration across all 15 operations
  • ✅ 2 new mailbox operations (MailboxSubscribe, MailboxMove)
  • ✅ Enhanced metadata for AI decision-making
  • ✅ Improved safety mechanisms and error handling
  • ✅ AI-friendly parameter descriptions and placeholders
  • ✅ Modular architecture with shared utilities

Original Project:

📝 License

MIT License - See LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.


Made with ❤️ for the n8n and AI automation community
Special thanks to Vasily Maslyukov for the original foundation! 🙏

changelog

2.8.0 (2025-05-26)

Features

  • if "Text Content" or "HTML Content" requested, but not present in the email, output NULL in the corresponding fields (cdd1bcd)

2.7.1 (2025-05-26)

Bug Fixes

  • Could not get parameter "includeInlineAttachments" error when "All Attachments" is false (b74fbe3)

2.7.0 (2025-04-21)

Features

  • add option to include inline attachments in "download attachments" operation (5d97f9f)

2.6.1 (2025-04-14)

Bug Fixes

2.6.0 (2025-04-14)

Features

  • added "Download as EML" operation (aab6e46)

2.5.0 (2025-03-08)

Features

  • added 'mailboxPath' to Email items output (dbda35f)

2.4.3 (2025-02-25)

Bug Fixes

  • issues with RFC822 content composition, (bb54fc1)

2.4.2 (2024-12-05)

Bug Fixes

  • fixed issue with reading emails from specific IMAP servers (Xeams) (5687b2e)

2.4.1 (2024-10-31)

Bug Fixes

  • "Mailbox Create" operation used incorrect input parameters resulting in failure to create mailbox (d38d029)

2.4.0 (2024-10-15)

Features

  • add "UID" to search filters in "Get Emails" operation (fa0260e)

2.3.0 (2024-09-04)

Features

  • email: Add Copy operation (12653d4)

2.2.0 (2024-08-15)

Features

  • mailbox: add "Get Quota" operation (62abb23)

2.1.1 (2024-07-27)

Bug Fixes

  • create draft: make field "Text" multiline (131e777)

2.1.0 (2024-07-27)

Features

  • "create email draft" operation (81e673f)

2.0.1 (2024-07-12)

Bug Fixes

  • "Credentials not found" error when using mailbox autocompletion with N8N IMAP credentials (1f9977b)

2.0.0 (2024-06-12)

⚠ BREAKING CHANGES

  • attachments: The downloadAttachment node output is changed. Each output item could now contain multiple binary fields named "attachment_0", "attachment_1", etc. Previously, there was only one binary field per output item named "attachment".

Features

  • attachments: add option to download all attachments or a comma-separated list of attachment IDs (2c7a353)

1.3.1 (2024-05-30)

Bug Fixes

  • Check if IMAP server returned empty email content (53a5ed3)

1.3.0 (2024-05-27)

Features

  • option to include email headers (c3d89bb)
  • option to include specific headers only (f7c36dc)

Bug Fixes

  • close IMAP connection gracefully after use (b2d4bc3)
  • fix text and HTML email content conversion (102dea9)
  • retrieve HTML or Text content correctly for single-part messages (87a94f9)

1.2.3 (2024-02-14)

Bug Fixes

  • Don't terminate multiple items processing if a handler returned no data (b46f86d)

1.2.2 (2024-02-14)

Bug Fixes

  • dependabot: NPM IP package vulnerable to Server-Side Request Forgery (SSRF) attacks (3395bf9)

1.2.1 (2024-02-14)

Bug Fixes

  • If IMAP node had multiple items as input, only first one was processed (#5) (8c78e20)

1.2.0 (2024-02-11)

Features

  • support credentials from core N8N IMAP Trigger node (5959ca1)

1.1.1 (2024-01-07)

Bug Fixes

  • Checking for credentials problem during login and displaying server error message if failed (6207a80)
  • Don't show "Cannot read properties of undefined (reading 'filename')" error if IMAP server hadn't returned attachment data (5d306ad)

1.1.0 (2023-12-31)

Features

  • Added "Set Flags" operation (97c1166)

1.0.1 (2023-12-30)

Bug Fixes

  • Mailboxes in "select mailbox" fields are loading correctly (fixed credential retrieval) (0c48cc4)