IMAP icon

IMAP

Retrieve emails via IMAP

Overview

This node retrieves emails from an IMAP server based on specified criteria. It is useful for scenarios where users need to fetch multiple emails from a mailbox, filter them by date, flags, or search terms, and optionally include specific parts of the email such as text content, HTML content, attachments info, flags, size, body structure, and headers. For example, it can be used to automate email processing workflows, archive emails, or analyze email content programmatically.

Use Case Examples

  1. Fetch all recent flagged emails from the INBOX mailbox.
  2. Retrieve emails received within a specific date range and containing certain keywords in the subject.
  3. Get emails with specific flags like answered or deleted for further processing.

Properties

Name Meaning
Credential Type Selects the type of credentials to use for connecting to the IMAP server, either credentials from this node or from an existing N8N IMAP Trigger node.
Mailbox Specifies the mailbox path from which to retrieve emails. Can be selected from a list or entered as a full path.
Date Range Defines the start and end dates to filter emails by their received date.
Flags Filters emails based on their flags such as answered, deleted, draft, flagged, recent, and seen (read).
Search Filters Search filters to narrow down emails by BCC, CC, From, Subject, Text, To, or UID. Filters are case-insensitive and combined with AND logic.
Include Message Parts Specifies 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 Determines 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 associated with the email (if requested)
  • size - Size of the email (if requested)
  • bodyStructure - Structure of the email body (if requested)
  • headers - Headers of the email (if requested)
  • textContent - Text content of the email (if requested)
  • htmlContent - HTML content of the email (if requested)
  • attachmentsInfo - Information about attachments in the email (if requested)

Dependencies

  • IMAP server credentials (either from this node or from an existing N8N IMAP Trigger node)

Troubleshooting

  • Connection failures due to incorrect IMAP credentials or server settings. Verify credentials and server details.
  • Errors during email retrieval may occur if the mailbox path is incorrect or inaccessible.
  • If no emails are returned, check the filter criteria such as date range, flags, and search filters to ensure they match existing emails.
  • Errors related to IMAP protocol or server responses are logged and can be debugged using the node's debug settings.

Links

Discussion