IMAP icon

IMAP

Retrieve emails via IMAP

Overview

This node enables downloading email attachments from an IMAP mailbox. It connects to an IMAP server using provided credentials, accesses a specified mailbox, and downloads attachments from emails identified by their unique IDs (UIDs). Users can choose to download all attachments or select specific ones by their part IDs. Inline attachments such as embedded images in HTML emails can optionally be included.

Common scenarios include:

  • Automating the retrieval of invoice PDFs or reports sent via email.
  • Extracting attachments for further processing or storage in other systems.
  • Archiving email attachments automatically based on mailbox and email selection.

Practical example:

  • A user configures the node to connect to their company’s IMAP server, selects the "INBOX" mailbox, specifies the UID of an important email, and downloads all its attachments for processing in subsequent workflow steps.

Properties

Name Meaning
Credential Type Choose between using credentials defined in this node or reusing credentials from an existing IMAP trigger node. Options: "IMAP", "N8N IMAP Trigger Node".
Mailbox Select the mailbox folder to access. Can be chosen from a list or specified by full path (e.g., "INBOX").
Email UID The unique identifier of the email from which to download attachments.
All Attachments Boolean flag indicating 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. These IDs are found in the email's "attachmentsInfo" property. Required if "All Attachments" is false.
Include Inline Attachments Boolean flag to include inline attachments such as embedded images when downloading all attachments.

Output

The node outputs JSON data representing the downloaded attachments. Each attachment includes metadata and content, typically encoded in binary form suitable for further processing or saving. If multiple attachments are downloaded, they are output as an array of objects.

Binary data corresponds to the actual file contents of the attachments, allowing downstream nodes to save or manipulate these files.

Dependencies

  • Requires connection to an IMAP server with valid credentials.
  • Needs either credentials configured directly in the node or reused from an existing IMAP trigger node.
  • Environment variable N8N_LOG_LEVEL can influence logging verbosity (e.g., "debug" for detailed logs).

Troubleshooting

  • Connection failures: Errors during connecting to the IMAP server often indicate incorrect credentials, network issues, or server unavailability. Verify credentials and network access.
  • Invalid Email UID: Specifying a non-existent or incorrect email UID will result in no attachments being found. Confirm the UID matches an email in the selected mailbox.
  • Missing Attachment Part IDs: When not downloading all attachments, failing to provide valid part IDs will cause errors. Ensure part IDs are correctly obtained from the email metadata.
  • Permission issues: Insufficient permissions on the mailbox or attachments may cause errors. Check IMAP server permissions.
  • Error messages: The node throws descriptive errors including connection problems and operation failures. Review error messages for details and consult IMAP server logs if needed.

Links and References

Discussion