Tools
IMAP Blocks
Retrieve emails on-demand and download attachments using the IMAP protocol.
IMAP (Internet Message Access Protocol) is the standard protocol for fetching emails from a remote server. In addition to the IMAP Email Trigger, Mandala offers two action blocks for interacting with IMAP mailboxes at any step of a workflow.
1. IMAP: Get Attachments Block (imap_fetch_attachments)
The IMAP: Get Attachments block connects to a mailbox and downloads files attached to a specific email. It uses a persistent message UID to retrieve the attachments, making it perfect for chaining after an IMAP trigger.
Configuration Inputs
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
messageUid | string | Yes | - | The IMAP message UID (e.g. wire from {{trigger.email.id}}) |
imapHost | string | Yes | - | IMAP server hostname (e.g. imap.gmail.com) |
imapPort | string | Yes | 993 | IMAP server port |
imapSecure | dropdown | Yes | SSL | Security mode: SSL, TLS, or None |
imapUsername | string | Yes | - | Your email address |
imapPassword | string | Yes | - | Your password or App Password |
mailbox | string | No | INBOX | Folder where the message resides |
Outputs
attachments: An array of base64-encoded attachment objects:[ { "name": "invoice_123.pdf", "mimeType": "application/pdf", "data": "JVBERi0xLjQKJdPr6g...", "size": 45120 } ]count: Number of attachments found.messageUid: The target email's UID.
2. IMAP Standalone Block (imap)
The standalone IMAP block retrieves and filters emails on-demand at a specific point in your workflow execution.
Configuration Inputs
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
imapHost | string | Yes | - | IMAP server hostname |
imapPort | string | Yes | 993 | IMAP server port |
imapSecure | dropdown | Yes | SSL | Security mode: SSL, TLS, or None |
imapUsername | string | Yes | - | Your email username |
imapPassword | string | Yes | - | Password or App Password |
mailbox | string | No | INBOX | Folder to fetch emails from |
filterUnreadOnly | switch | No | false | Retrieve only unread messages |
markAsRead | switch | No | false | Mark emails as read after processing |
includeAttachments | switch | No | false | Whether to parse and include attachments |
maxResults | number | No | 10 | Maximum number of emails to retrieve |
filterFrom | string | No | - | Filter emails by sender address |
filterSubject | string | No | - | Filter emails by subject keyword |
Outputs
emails: Array of retrieved emails:[ { "id": "12345", "subject": "June Invoice", "from": "billing@company.com", "to": "you@domain.com", "cc": "finance@domain.com", "date": "2026-06-16T10:15:30.000Z", "bodyText": "Hello...", "bodyHtml": "<p>Hello...</p>", "hasAttachments": false, "attachments": [] } ]count: Total number of emails retrieved.
Typical Workflow: Email Attachment Parser
Here is the recommended setup to automatically process incoming email attachments:
graph TD
A["IMAP Trigger<br>(/triggers/imap)"] -->|ID: trigger.email.id| B["IMAP: Get Attachments<br>(downloads base64 files)"]
B -->|Data: attachments[0].data| C["Parser Block<br>(Processes file)"]Wiring Instructions:
- Configure the IMAP Trigger to listen for emails.
- Connect it to IMAP: Get Attachments. Wire Message UID to:
{{trigger.email.id}} - Pass the file data to your Parser block using:
{{imap_fetch_attachments.attachments[0].data}}