IMAP icon

IMAP

Retrieve emails via IMAP

Actions6

Overview

This n8n node allows you to retrieve emails via the IMAP protocol. It is designed to connect to an IMAP server using user-supplied credentials, perform operations (such as fetching messages or listing mailboxes), and output the results for further processing in your workflow.

Common scenarios:

  • Automating the retrieval of emails from a mailbox for processing, archiving, or integration with other systems.
  • Triggering workflows based on new or specific emails.
  • Extracting attachments or email content for downstream automation.

Practical examples:

  • Download all unread emails from a support inbox and create tickets in a helpdesk system.
  • Monitor a mailbox for invoices and extract PDF attachments for accounting automation.

Properties

Name Type Meaning
Credential Type options Selects which set of credentials to use for connecting to the IMAP server.

Credential Type options:

  • IMAP: Use credentials defined directly in this node.
  • N8N IMAP Trigger Node: Use credentials from an existing n8n IMAP Trigger node.

Note: Additional properties such as "Resource" and "Operation" are present but not detailed here, as per your request.

Output

  • The node outputs data in the json field, containing the results of the selected resource and operation.
  • The structure of the output depends on the chosen resource and operation, but typically includes email metadata (subject, sender, date) and message content.
  • If the operation returns no data, a warning is logged.
  • If binary data (e.g., attachments) is returned, it will be included in the output as binary fields.

Dependencies

  • External services: Requires access to an IMAP server (e.g., Gmail, Outlook, custom mail server).
  • Credentials: IMAP account credentials must be provided, either directly in the node or via another n8n node.
  • Environment variables: Optionally uses N8N_LOG_LEVEL to control debug logging.

Troubleshooting

Common issues:

  • Connection failed: Incorrect IMAP credentials or server details will prevent connection. Check username, password, host, and port.
  • Unknown operation/resource: If an invalid combination is selected, the node will throw an error indicating the unknown operation or resource.
  • IMAP server errors: Errors reported by the IMAP server (e.g., authentication failure, mailbox not found) are captured and shown in the error message.

Error messages:

  • "Connection failed: ..." – Indicates a problem establishing a connection; verify credentials and network access.
  • "Unknown operation ... for resource ..." – The selected operation is not supported for the chosen resource.
  • "The following errors were reported by the IMAP server: ..." – Details specific IMAP server-side issues.

Links and References

Discussion