IMAP icon

IMAP

Retrieve emails via IMAP

Email → Download Attachment

AI-generated

Summary

Download selected attachments from an email in a chosen mailbox and return them as binary data with attachment metadata. You can select specific MIME part IDs or download every attachment, optionally including inline attachments.

Inputs

  • authentication — Choose this node’s IMAP credentials or credentials from the n8n IMAP Trigger node; defaults to this node’s credentials.
  • mailboxPath (required) — Mailbox containing the email. Select a listed mailbox or enter its full path; defaults to INBOX.
  • emailUid — UID of the email to download attachments from.
  • allAttachments — When false (default), download the specified part IDs. When true, discover and download all parts marked as attachments.
  • partId (required) — When downloading selected attachments, provide a comma-separated list of MIME part IDs. The email’s attachmentsInfo property can provide these IDs.
  • includeInlineAttachments — When downloading all attachments, include parts marked inline, such as images embedded in HTML. Defaults to false.

Output shape

A single item containing binary attachment fields and JSON metadata.

Each attachment is stored in a binary field named attachment_0, attachment_1, and so on. json.attachments is an array of metadata entries containing partId, binaryFieldName, IMAP-provided metadata such as filename and contentType, and the downloaded size in bytes. If no matching attachments are found, the item still returns with an empty attachments array and no binary fields.

Links

Discussion