import
Copy pods, domains, inboxes, webhooks and allow and block lists from AgentMail into MachineMail with the import agentmail command: flags and examples.
Copy settings from another provider into MachineMail (import agentmail).
| Command | Summary |
|---|---|
import agentmail | Copy AgentMail settings (pods, domains, inboxes, webhooks, lists) into MachineMail |
Every command also takes the global flags.
import agentmail
Copy AgentMail settings (pods, domains, inboxes, webhooks, lists) into MachineMail.
Reads your AgentMail account with your AgentMail API key, on this machine, and recreates its settings in the MachineMail organization of your MachineMail key through the public API. Mail is never imported: no threads, messages, drafts or attachments. Nothing at AgentMail is changed: the importer only reads.
The AgentMail key comes from AGENTMAIL_API_KEY, --key-file, or a hidden prompt. It is never accepted as an argument, never printed (it shows as am_us_…abcd) and sent only to AgentMail (api.agentmail.to, or api.agentmail.eu with --region eu; the region is read from the am_us_ / am_eu_ prefix). MachineMail never sees it. A pod- or inbox-scoped key imports only that pod or inbox.
Imported: pods (name, client_id); custom domains (you publish the new DNS records, then switch MX: mail keeps going to AgentMail until you do); inboxes (display name, metadata, client_id, status, pod; custom-domain addresses stay the same, @agentmail.to addresses get the same name on the shared domain, a suggested name when that is taken or reserved, or your --rename); allow and block lists at every level, except AgentMail-managed read-only entries; webhooks, always created disabled, with a new signing secret and event types mapped. Inboxes are created with import_source: agentmail: their inbox.created events are recorded but not sent to webhooks.
Not imported, and listed in the report: API keys (names and scopes, to recreate), polling webhooks, read-only list entries, event types and settings MachineMail has no equivalent for.
Re-running is safe: every object carries a client_id (the AgentMail one, else am:<agentmail id>), so a second run reports already imported and creates nothing. After importing, the command writes an ID map (old to new ids, JSON and CSV) and prints the cutover checklist.
Exit codes: 0 when everything planned was imported (or already was); 1 when the plan limits stopped the import before anything was written, or when some items failed (the error names the limits; --json lists failures); 2 for a usage error; 3 when a key is refused or cannot do the import (for example a pod-scoped MachineMail key with an organization AgentMail key); 5 or 6 when AgentMail kept rate limiting or could not be reached; 130 when interrupted.
Flags
--dry-runboolean--key-file <path|->string--region <us|eu>us | eu--rename <old=new>string[]--skip <id|address>string[]--map-file <path>string