Email for n8n Agents
Give every n8n workflow its own inbox. Trigger workflows from inbound email, send replies in thread, and handle full conversations — no SMTP config, no deliverability headaches.
How OpenMail works with n8n
Create an inbox with an HTTP Request node
Add an HTTP Request node to your n8n workflow. One call to the OpenMail API provisions a live inbox on your domain and returns the address immediately. This call uses your account key, which stays in the provisioning workflow.
Method: POST
URL: https://api.openmail.sh/v1/inboxes
Headers:
Authorization: Bearer {{ $env.OPENMAIL_ACCOUNT_KEY }}
Content-Type: application/json
Body:
{ "mailboxName": "{{ $json.agentName }}" }
Response:
{ "id": "inb_8f3a1b2c", "address": "agent@yourdomain.com" }Mint a key scoped to that inbox
Add a second HTTP Request node to mint a key that reaches only the inbox you just created. It can read and send from that one inbox and nothing else, so a workflow handling untrusted mail can't touch another workflow's inbox. The token comes back once — write it straight to the workflow's credentials.
Method: POST
URL: https://api.openmail.sh/v1/inboxes/{{ $json.id }}/api-keys
Headers:
Authorization: Bearer {{ $env.OPENMAIL_ACCOUNT_KEY }}
Content-Type: application/json
Body:
{ "name": "workflow:{{ $json.agentName }}" }
Response:
{ "token": "om_...", "inboxId": "inb_8f3a1b2c" }
# Shown once, never retrievable again.Store credentials in n8n environment variables
Save all three as n8n environment variables — the key is the inbox-scoped one you just minted, not your account key, so this workflow can only reach its own inbox.
OPENMAIL_API_KEY=om_... # scoped to this inbox only
OPENMAIL_INBOX_ID=inb_8f3a1b2c
OPENMAIL_ADDRESS=agent@yourdomain.comSend and reply from your workflow
Use an HTTP Request node to send email from your agent's inbox. Pass threadId to reply in the same thread — the reply arrives threaded correctly in the recipient's email client.
Method: POST
URL: https://api.openmail.sh/v1/inboxes/{{ $env.OPENMAIL_INBOX_ID }}/send
Headers:
Authorization: Bearer {{ $env.OPENMAIL_API_KEY }}
Content-Type: application/json
Body:
{
"to": "{{ $json.recipient }}",
"subject": "{{ $json.subject }}",
"body": "{{ $json.body }}",
"threadId": "{{ $json.threadId }}"
}Trigger your n8n workflow from inbound email
Register your n8n webhook URL in the OpenMail dashboard. Every inbound email fires a structured JSON POST to your workflow — parsed message body, full thread context, and extracted attachments included. Webhook config is account-level on purpose: an inbox-scoped key can't repoint it, so a compromised workflow can't redirect its own mail.
{
"event": "message.received",
"inbox_id": "inb_8f3a1b2c",
"thread_id": "thr_9d4e5f6a",
"message": {
"from": "customer@example.com",
"subject": "Re: Your order",
"body_text": "Thanks for following up...",
"attachments": [
{
"filename": "receipt.pdf",
"parsedText": "Order confirmation #1042"
}
]
}
}What n8n agents use email for
Customer support
Receive tickets, reply in thread, escalate when needed — no human in the loop for routine enquiries.
Invoice processing
Receive vendor emails, parse PDF attachments into structured data, and route line items to accounting automatically.
Sales follow-ups
Send personalised outbound sequences, receive replies in full thread context, and continue the conversation without leaving n8n.
Account verification
Receive OTP codes and confirmation links autonomously — complete signup and verification flows without human involvement.
Internal ops
HR and IT request handling via dedicated agent inboxes — employees email in, your workflow handles the rest.
What's included
Dedicated inbox per agent
Each n8n workflow gets its own address on your domain — no shared inboxes, no filtering logic required.
Webhook inbound delivery
Every inbound email fires a structured JSON POST into your n8n workflow in under 500ms. No polling, no IMAP.
Full thread history as structured JSON
Every inbound reply includes complete thread context — your workflow always has the full conversation available.
Attachment parsing
PDF, CSV, and DOCX files automatically extracted to plain text and included in the webhook payload.
Managed deliverability
SPF, DKIM, and DMARC configured automatically on provisioning. Primary inbox from day one.
Works with n8n Cloud and self-hosted
REST API and webhooks, no special setup. Works with any n8n deployment as long as your webhook endpoint is reachable.