Integration Guide

n8n Integration

Trigger n8n workflows instantly when emails arrive. No IMAP polling, no complex parsing — just structured JSON delivered to your webhook trigger.

Why Use Mailhooks with n8n?

The built-in n8n IMAP node has limitations:

Polling delays

IMAP triggers check on intervals, not in real-time

Connection management

OAuth tokens expire, IMAP connections drop

Email parsing

MIME parsing is complex and error-prone

No delivery guarantees

If polling fails, emails can be missed with no retry

How It Works

  1. 1Email arrives at your Mailhooks inbox
  2. 2Mailhooks parses the email into structured JSON
  3. 3Webhook delivers the payload to your n8n workflow
  4. 4n8n processes the data with any nodes you choose

If n8n is temporarily unavailable, Mailhooks queues the webhook and retries automatically.

Setup Guide

Step 1

Create a Webhook Trigger in n8n

  1. 1. Open n8n and create a new workflow
  2. 2. Add a Webhook trigger node
  3. 3. Set HTTP Method to POST
  4. 4. Copy the Webhook URL (Production URL for live workflows)
Step 2

Create a Mailhooks Inbox

  1. 1. Go to Dashboard → Domains
  2. 2. Add a domain or use your existing one
  3. 3. Go to Hooks and click Add Hook
  4. 4. Select Webhook and paste your n8n webhook URL
  5. 5. Click Create

You'll get an email address like [email protected]

Step 3

Test the Integration

  1. 1. Send a test email to your new inbox address
  2. 2. Check your n8n workflow execution history
  3. 3. The email data will appear as JSON in the webhook output

Webhook Payload

Mailhooks sends this JSON structure to your n8n webhook:

{
  "id": "msg_abc123",
  "from": "[email protected]",
  "to": "[email protected]",
  "subject": "New Purchase Request",
  "text": "Please process order #789...",
  "html": "

Please process order #789...

", "date": "2024-01-15T10:30:00Z", "attachments": [ { "filename": "purchase-order.pdf", "contentType": "application/pdf", "size": 34567, "url": "https://files.mailhooks.dev/..." } ], "headers": { "message-id": "", "reply-to": "[email protected]" } }

Accessing Email Data in n8n

In subsequent nodes, access the email data using expressions:

ExpressionDescription
{{ $json.from }}Sender email address
{{ $json.to }}Recipient email address
{{ $json.subject }}Email subject line
{{ $json.text }}Plain text body
{{ $json.html }}HTML body
{{ $json.attachments[0].url }}First attachment download URL

Downloading Attachments

To download attachments in your workflow:

  1. 1Add an HTTP Request node after your webhook trigger
  2. 2Set Method to GET
  3. 3Set URL to {{ $json.attachments[0].url }}
  4. 4Set Response Format to File

The attachment will be available for further processing (e.g., upload to Google Drive, parse CSV, etc.).

Example Workflows

Forward Emails to Slack

  1. 1. Webhook trigger (receives email)
  2. 2. Slack node (send message)

Save Attachments to Google Drive

  1. 1. Webhook trigger
  2. 2. IF node (check attachments)
  3. 3. HTTP Request (download)
  4. 4. Google Drive (upload)

Create Notion Page from Email

  1. 1. Webhook trigger
  2. 2. Notion node (create page)

Process Order Emails

  1. 1. Webhook trigger
  2. 2. Code node (extract order #)
  3. 3. HTTP Request (call API)
  4. 4. Slack (notify team)

Advanced Configuration

Multiple Inboxes, One Workflow

Create multiple Mailhooks inboxes pointing to the same n8n webhook. Use the to field to route emails:

// In a Switch node
if ($json.to.includes('orders@')) {
  return 'orders';
} else if ($json.to.includes('support@')) {
  return 'support';
}

Domain-Specific Inboxes

Mailhooks supports catch-all addresses. Any email to *@yourdomain.com reaches your inbox, so:

All trigger the same webhook — use the to field to differentiate.

Filtering Emails

Add conditions in n8n to filter which emails trigger actions:

// Only process emails from specific domains
if ($json.from.endsWith('@company.com')) {
  return true;
}
return false;

Reliability

Webhook Retries

If your n8n instance is temporarily unavailable, Mailhooks queues the webhook, retries with exponential backoff, and continues retrying for up to 24 hours.

Webhook Logs

View delivery status in Dashboard → Hooks → Logs: Delivered, Pending, or Failed.

Troubleshooting

Webhook not triggering

  • Verify the webhook URL is correct in Mailhooks
  • Ensure n8n workflow is Active (not in test mode for production URL)
  • Check the n8n execution history for errors
  • Test with a simple email first

Missing attachments

  • Confirm Include Attachments is enabled in your inbox settings
  • Attachment URLs expire after 24 hours — download promptly
  • Check attachment size limits (50MB max per email)

Parsing issues

  • Use a Code node with regex or string methods
  • Use the HTML Extract node for HTML emails
  • Consider the Extract from File node for attachments

Comparison: Mailhooks vs IMAP Node

FeatureMailhooks Webhookn8n IMAP Node
Latency Instant (< 10s) Polling interval
Setup 2 minutes Complex OAuth/IMAP
Attachments Direct URLs Manual extraction
Email parsing Pre-parsed JSON Raw MIME
Reliability Queued + retries Requires n8n uptime
Connection management None required Token refresh needed

Getting Started

Total setup time: ~5 minutes.

© 2026 Mailhooks. All rights reserved.