IMAP icon

IMAP

Retrieve emails via IMAP

Actions6

Overview

This node allows you to create a new mailbox (folder) on an IMAP email server. It is useful for organizing emails by creating custom folders, either as top-level mailboxes or as subfolders under existing mailboxes. Common scenarios include automating the setup of folder structures for incoming emails, preparing mailboxes for specific projects or clients, or dynamically managing mailbox organization as part of larger workflows.

Practical examples:

  • Automatically create a "Support Tickets" mailbox when onboarding a new client.
  • Set up a nested folder structure for project-based email management.
  • Prepare a temporary mailbox for archiving emails during a workflow run.

Properties

Name Type Meaning
Credential Type options Selects which credentials to use for connecting to the IMAP server: either from this node or from an existing N8N IMAP Trigger node.
Top Level Mailbox boolean Determines if the new mailbox should be created as a top-level mailbox (true) or as a child mailbox (false). Required.
Mailbox resourceLocator Specifies the parent mailbox under which to create the new mailbox. Only required if not creating a top-level mailbox. Can be selected from a list or specified by full path.
Mailbox Name string The name of the new mailbox to create. Required.

Output

The node outputs a JSON object containing information about the newly created mailbox. While the exact structure may depend on the IMAP server and implementation, typical fields may include:

{
  "mailboxName": "string",         // The name of the created mailbox
  "mailboxPath": "string",         // The full path to the created mailbox
  "parentMailbox": "string|null",  // The parent mailbox, if applicable
  "status": "string"               // Status message or confirmation
}

If the operation fails, the node will throw an error with a descriptive message.

Dependencies

  • IMAP Server: Requires access to an IMAP-compatible email server.
  • Credentials: You must provide valid IMAP credentials, either directly in this node or via an existing N8N IMAP Trigger node.
  • n8n Configuration: No special environment variables are required unless you want to enable debug logging (N8N_LOG_LEVEL=debug).

Troubleshooting

Common Issues:

  • Authentication Failure: If credentials are incorrect or insufficient, the node will fail to connect to the IMAP server.
  • Mailbox Already Exists: Attempting to create a mailbox with a name that already exists may result in an error from the IMAP server.
  • Invalid Parent Mailbox: Specifying a non-existent parent mailbox will cause the operation to fail.
  • Connection Errors: Network issues or server misconfiguration can prevent successful connection.

Error Messages:

  • "Connection failed: ..." – Indicates a problem connecting to the IMAP server. Check credentials and network connectivity.
  • "Unknown operation \"createMailbox\" for resource \"mailbox\"" – Internal configuration issue; ensure you are using supported operations.
  • "Operation \"createMailbox\" for resource \"mailbox\" returned no data" – The operation did not return any result; check server logs or parameters.
  • "IMAP server reported errors: ..." – The IMAP server returned one or more errors; review the error details for resolution.

Links and References

Discussion