IMAP icon

IMAP

Retrieve emails via IMAP

Email → Set Flags

AI-generated

Overview

This node operation allows users to set or remove IMAP flags on specific emails within a selected mailbox. It is useful for managing email states such as marking emails as seen, flagged, deleted, or answered, and for applying custom flags. Practical scenarios include automating email organization, marking emails as read after processing, or flagging important messages for follow-up.

Use Case Examples

  1. Mark an email as seen after it has been processed by an automation workflow.
  2. Flag important emails for review by setting the \Flagged flag.
  3. Remove the \Deleted flag from emails to prevent them from being deleted.

Properties

Name Meaning
Credential Type Selects the type of IMAP credentials to use for authentication, either from this node or from an existing N8N IMAP Trigger node.
Mailbox Specifies the mailbox path where the email resides. Can be selected from a list or entered as a full path.
Email UID The unique identifier(s) of the email(s) to set flags on. Supports comma-separated lists.
Flags Collection of flags to set or remove on the email(s). Includes standard IMAP flags like Answered, Deleted, Draft, Flagged, Seen, and options to set or remove custom flags.

Output

JSON

  • json - The result of the flag setting operation, including success or error details for each processed email.

Dependencies

  • Requires IMAP credentials, either provided directly in the node or via an existing N8N IMAP Trigger node.

Troubleshooting

  • Connection failures due to incorrect IMAP credentials or network issues. Verify credentials and network connectivity.
  • Errors related to invalid mailbox paths or email UIDs. Ensure the mailbox exists and UIDs are correct.
  • Operation failures if the IMAP server does not support certain flags or if permissions are insufficient.
  • Common error messages include connection failure, operation failure, and unknown operation errors. These can be resolved by checking credentials, mailbox paths, and flag syntax.

Discussion