IMAP icon

IMAP

Retrieve emails via IMAP

Overview

This node operation downloads attachments from emails in an IMAP mailbox. It supports downloading all attachments or specific attachments by their part IDs, and can include inline attachments if desired. This is useful for automating the retrieval of email attachments for processing, storage, or further workflow actions, such as saving invoices, reports, or images received via email.

Use Case Examples

  1. Download all attachments from a specific email in the INBOX mailbox.
  2. Download selected attachments by specifying their part IDs from an email in a custom mailbox path.
  3. Include inline images embedded in HTML emails when downloading attachments.

Properties

Name Meaning
Credential Type Selects which IMAP credentials to use for connecting to the mailbox (either credentials from this node or from an existing N8N IMAP Trigger node).
Mailbox The mailbox path to select the folder from which to download attachments.
Email UID The unique identifier of the email from which to download attachments.
All Attachments Whether to download all attachments from the email.
Attachment Part IDs Comma-separated list of specific attachment part IDs to download when not downloading all attachments. Part IDs are found in the email's attachmentsInfo property.
Include Inline Attachments Whether to include inline attachments such as images embedded in HTML emails when downloading all attachments.

Output

JSON

  • attachmentData - The downloaded attachment data, typically including file content and metadata such as filename and MIME type.
  • pairedItem
    • item - Index of the input item the attachment corresponds to, useful for tracking attachments back to their source email.

Dependencies

  • Requires IMAP credentials, either provided directly in the node or via an existing N8N IMAP Trigger node's credentials.

Troubleshooting

  • Connection failures due to incorrect IMAP credentials or network issues. Verify credentials and network access to the mail server.
  • Errors indicating unknown operations or resources suggest misconfiguration of the node parameters; ensure the resource is set to 'Email' and operation to 'Download Attachment'.
  • Errors related to attachment part IDs usually mean the specified IDs do not exist in the email; verify the part IDs from the email's attachmentsInfo property.
  • If the node returns no data, check that the email UID is correct and that the email contains attachments matching the criteria.

Discussion