IMAP icon

IMAP

Retrieve emails via IMAP

Email → Get Many

AI-generated

Overview

This node operation retrieves multiple emails from an IMAP mailbox based on specified criteria. It is useful for scenarios where you need to fetch a list of emails filtered by date range, flags, search filters, or specific UIDs. For example, you can use it to get all unread emails from the INBOX received since a certain date, or to fetch emails flagged as important with specific subject keywords.

Use Case Examples

  1. Fetch up to 50 recent unread emails from the INBOX mailbox.
  2. Retrieve emails flagged as answered and containing specific text in the subject.
  3. Get emails within a date range and filter by sender or recipient addresses.

Properties

Name Meaning
Credential Type Selects which IMAP credentials to use for connecting to the mailbox.
Mailbox The mailbox path to retrieve emails from, e.g., INBOX.
Date Range Filters emails by date, specifying start (since) and end (before) dates.
Flags Filters emails based on IMAP flags such as answered, deleted, draft, flagged, recent, seen, or custom flags.
Search Filters Additional case-insensitive filters combined with AND logic, such as filtering by BCC, CC, From, Subject, Text, To, or specific UIDs.
Limit Maximum number of emails to return to prevent memory issues and long execution times.
Include Message Parts Select which parts of the email to include in the output, such as text content, HTML content, attachments info, flags, size, body structure, and headers.
Include All Headers Whether to include all headers in the output when headers are included.
Headers to Include Comma-separated list of specific headers to include if not including all headers.

Output

JSON

  • uid - Unique identifier of the email
  • flags - Flags set on the email, e.g., seen, answered
  • date - Date the email was sent or received
  • from - Sender's email address
  • to - Recipient email addresses
  • cc - CC recipient email addresses
  • bcc - BCC recipient email addresses
  • subject - Subject line of the email
  • textContent - Plain text content of the email if included
  • htmlContent - HTML content of the email if included
  • attachmentsInfo - Information about attachments if included
  • size - Size of the email if included
  • bodyStructure - Structure of the email body if included
  • headers - Email headers if included

Dependencies

  • IMAP server credentials (either node-specific or from N8N IMAP Trigger node)

Troubleshooting

  • Connection failures due to incorrect IMAP credentials or network issues. Verify credentials and network connectivity.
  • Errors during email retrieval may occur if the mailbox path is incorrect or the IMAP server is unreachable.
  • If the operation returns no data, check the filter criteria such as date range, flags, and search filters to ensure they match existing emails.
  • Errors related to IMAP protocol or unexpected server responses are caught and logged; reviewing logs can help identify issues.

Discussion