IMAP icon

IMAP

Retrieve emails via IMAP

Overview

This node enables creating an email draft in a specified mailbox using the IMAP protocol. It is useful for workflows that need to programmatically prepare emails without sending them immediately, such as saving drafts for later review or automated email composition.

Typical use cases include:

  • Automatically drafting emails based on triggers or data inputs.
  • Preparing complex emails with attachments (when combined with other nodes that generate RFC822 formatted emails).
  • Integrating with existing mailboxes to manage drafts remotely.

For example, you could automate customer support replies by drafting personalized responses into a shared mailbox for review before sending.

Properties

Name Meaning
Credential Type Choose which credentials to use for connecting to the IMAP server: either credentials defined directly in this node or credentials from an existing IMAP trigger node.
Mailbox Select the target mailbox where the draft will be created. You can choose from a list of available mailboxes or specify the full path manually.
Input Format Specify how the email content is provided: either as individual fields (subject, from, to, text) or as a complete RFC822 formatted email string.
Use n8n-nodes-eml Notice recommending the use of the n8n-nodes-eml node to compose complex emails with attachments and then provide the output as RFC822 format for this node. This appears only when "Fields" input format is selected.
Subject The subject line of the email draft (used when input format is "Fields").
From The sender's email address (used when input format is "Fields").
To The recipient's email address (used when input format is "Fields").
Text The plain text body of the email (used when input format is "Fields").
RFC822 Formatted Email The entire email content as a raw RFC822 formatted string, including headers and body. Required if input format is set to "RFC822 Formatted Email".

Output

The node outputs JSON data representing the result of the draft creation operation. Typically, this includes metadata about the created draft message such as its unique identifier within the mailbox.

If binary data were involved (e.g., attachments), it would be summarized here, but this node focuses on draft creation via IMAP and does not explicitly output binary data.

Dependencies

  • Requires access to an IMAP server with appropriate credentials.
  • Needs either credentials configured directly in the node or credentials from an existing IMAP trigger node.
  • Optionally integrates with the n8n-nodes-eml node for composing complex emails in RFC822 format.
  • Environment variable N8N_LOG_LEVEL can influence logging verbosity (e.g., debug mode).

Troubleshooting

  • Connection failures: Errors during connection to the IMAP server will throw messages like "Connection failed: ...". Verify credentials, network connectivity, and IMAP server availability.
  • Unknown operation/resource errors: If the node configuration specifies an unsupported resource or operation, it will error out indicating unknown operation/resource.
  • Empty or no data returned: If the operation returns no data, a warning is logged. Ensure the input parameters are correct and the mailbox exists.
  • Error handling: The node catches IMAP-specific errors and wraps them into user-friendly messages. Check logs for detailed error information.
  • Slow response notice: When using the "Fields" input format, composing complex emails might be slow; using RFC822 format with the recommended external node can improve performance.

Links and References

Discussion