How the pieces fit together
- OpenClaw runs your agent and handles tool and skill execution.
- MailChannels Email API handles sending email and reports delivery events (delivered, bounced, dropped) back to your agent via webhooks.
- AgentMail (optional, but recommended) gives your agent a dedicated inbox — separate from your personal email — with support for real-time events and reply handling.
What you need before you start
- A self-hosted OpenClaw installation.
- MailChannels Email API credentials:
MAILCHANNELS_API_KEYandMAILCHANNELS_ACCOUNT_ID(your customer handle). - DNS access for the domain you plan to send from.
- Optionally: a public HTTPS endpoint where MailChannels can POST delivery webhooks.
Setting up the integration
Set up your MailChannels credentials
The MailChannels skill for OpenClaw reads two environment variables:
MAILCHANNELS_API_KEY— sent in theX-Api-Keyheader on every request.MAILCHANNELS_ACCOUNT_ID— your customer handle, visible in the MailChannels Console.
MAILCHANNELS_BASE_URL— defaults tohttps://api.mailchannels.net/tx/v1.
Lock down your sending domain
Before letting your agent send email from your domain, configure Domain Lockdown via a DNS TXT record. This ensures only your MailChannels account can send as that domain.For each domain you plan to send from, add a TXT record:
After adding the record, you can verify your full domain configuration (DKIM, SPF, and Domain Lockdown) using the
| Field | Value |
|---|---|
| Host | _mailchannels.<your-domain> |
| Value | v=mc1; auid=<YOUR_ACCOUNT_ID> |
POST /check-domain endpoint.Your domain should also have a valid SPF record that authorizes MailChannels as a sender. Without SPF, deliverability will be poor and some receiving servers will reject your mail.
Install the MailChannels skill in OpenClaw
The MailChannels integration is published as an OpenClaw skill called This skill handles two things: sending email through the MailChannels API, and ingesting signed delivery-event webhooks into your OpenClaw environment.
mailchannels-email-api. Install it with:Send your first email
MailChannels exposes a Once the skill is installed and your environment variables are set, you can skip
POST /send endpoint. The minimum payload requires four fields: personalizations (who you are sending to), from, subject, and content.Here is a curl example showing what happens under the hood:curl entirely and just instruct your agent:Send an email to me using MailChannels with the subject “Test” and a one-line body confirming it worked.The agent takes it from there.
Use async sending for agent workflows
In agent workflows, you usually do not want your agent blocking while an email is processed — especially when sending to multiple recipients.Use
POST /send-async instead of POST /send. This endpoint queues the message and returns immediately with a request ID. Delivery events still arrive via webhooks, so your agent retains full visibility and can move on to its next task without waiting.Close the loop with delivery webhooks
Sending is only half the story. A genuinely useful agent can also answer: Did it deliver? Did it bounce? Should I retry or suppress that recipient?Register a webhook endpointUse the following endpoints to manage your webhook subscriptions:
Verify webhook signaturesMailChannels signs every delivery-event webhook. Incoming requests include three headers:
| Endpoint | Description |
|---|---|
POST /webhook | Enroll for webhook notifications |
GET /webhook | Retrieve enrolled webhooks |
DELETE /webhook | Remove webhooks you no longer need |
POST /webhook/validate | Test that your endpoint is reachable |
GET /webhook/public-key | Retrieve the webhook signing key |
Content-Digest, Signature-Input, and Signature.To verify them:- Parse
Signature-Input— it includescreated,alg, andkeyid. - Reject anything with a stale timestamp.
- Fetch the public key for the given
keyidusingGET /webhook/public-key. - Verify the Ed25519 signature per RFC 9421.
email, customer_handle, timestamp, event, and request_id. Persist the request_id from each send call so you can match it to delivery events and build a clean state machine: processed → delivered, soft-bounced, hard-bounced, or dropped.This is what lets your agent make smart decisions — retry on a soft bounce, suppress on a hard bounce, escalate on repeated failures.Give your agent an inbox with AgentMail
Everything above handles outbound email. Agents often also need to receive messages — replies, confirmations, OTP codes, inbound support requests.AgentMail is an API-first inbox provider built specifically for AI agents. Install the official OpenClaw integration with either:or via the ClawHub CLI:Then add your AgentMail API key to AgentMail supports programmatic inbox creation, including custom domains. Once configured, your agent can receive replies in a dedicated inbox, search and triage messages, and trigger workflows from inbound email — all without touching your personal mailbox.
~/.openclaw/openclaw.json:Ideas for what to build next
With MailChannels handling outbound and AgentMail handling inbound, your OpenClaw agent is ready for workflows that feel hands-free but stay operationally sound:- Daily briefings — Your agent compiles calendar items, tasks, and news into a single email, sends it via MailChannels, and tracks delivery.
- Support triage — Inbound email arrives at AgentMail, the agent labels and routes it, then sends a reply (or drafts one for your approval) through MailChannels.
- Deliverability-aware automation — If a recipient hard-bounces, the agent automatically adds them to the suppression list and notifies your ops team.
API quick reference
Base URL:https://api.mailchannels.net/tx/v1
| Category | Endpoint | Description |
|---|---|---|
| Sending | POST /send | Send an email synchronously |
| Sending | POST /send-async | Queue an email and return immediately |
| Webhooks | POST /webhook | Enroll for webhook notifications |
| Webhooks | GET /webhook | Retrieve enrolled webhooks |
| Webhooks | DELETE /webhook | Delete webhooks |
| Webhooks | POST /webhook/validate | Test your webhook endpoint |
| Webhooks | GET /webhook/public-key | Retrieve the webhook signing key |
| Domains | POST /check-domain | Check DKIM, SPF, and Domain Lockdown |
| Usage | GET /usage | Retrieve account usage stats |
| Suppression | POST /suppression-list | Add suppression entries |
| Suppression | GET /suppression-list | Retrieve the suppression list |
| Suppression | DELETE /suppression-list/recipients/:recipient | Remove a suppression entry |

