IMAP icon

IMAP

Connect to IMAP servers to manage emails and mailboxes

Overview

This node connects to an IMAP email server to perform various email management operations. Specifically, the "Get Email" operation retrieves a single email by its unique identifier (UID) from a specified mailbox folder. This is useful for workflows that need to fetch detailed information about a particular email, such as reading its content, processing attachments, or triggering actions based on email data.

Practical examples include:

  • Automatically fetching and processing support emails from the INBOX.
  • Retrieving specific emails for archival or analysis.
  • Integrating email content into other systems like CRMs or ticketing tools.

Properties

Name Meaning
Folder The email folder to work with. Can be selected from a list of available folders or entered manually (e.g., "INBOX").
Email UID The unique identifier of the email to retrieve. Required to specify which email to get.

Output

The output is an array of items where each item contains a json object representing the retrieved email's data. The structure of this JSON typically includes standard email fields such as sender, recipient, subject, date, body content, and possibly metadata related to the email.

If the node supports binary data (not explicitly shown here), it would typically include attachments or raw email content in a binary field, but this is not detailed in the provided code snippet.

Dependencies

  • Requires connection to an IMAP server with valid credentials (host, port, username, password).
  • Needs an API key credential or authentication token configured in n8n to access the IMAP server.
  • Uses the external library imapflow to handle IMAP protocol communication.

Troubleshooting

  • Connection issues: Errors connecting to the IMAP server may occur if host, port, or credentials are incorrect. Verify these settings and network accessibility.
  • Timeouts: The node sets timeouts for socket, connection, and greeting phases. If the server is slow or unresponsive, consider increasing timeout values or checking server health.
  • Invalid Email UID: If the specified email UID does not exist in the folder, the operation will fail. Ensure the UID is correct and corresponds to an existing email.
  • Logout errors: Occasionally, logout or client close operations may timeout or fail; these are logged but do not usually affect the main operation result.
  • Continue on Fail: If enabled, the node will continue processing subsequent items even if one fails, returning error details in the output.

Links and References

Discussion