Guide
Migrate from SMTP to Agent Accounts
A self-hosted SMTP server is five systems an agent shouldn't have to own: a mail daemon, MX records, TLS certificates, spam filtering, and a MIME parser. Migrating to an agent account collapses all five into one managed identity. This guide maps your existing sends to a single CLI command, replaces the MX you used to run with managed inbound, gives you a cutover plan with a dual-send safety net, and is honest about the few things that don't map one-to-one.
Written by Qasim Muhammad Staff SRE
What does migrating from SMTP to an agent account involve?
Migrating from SMTP to an agent account means swapping a mail server you operate for a managed identity you call. The work has three parts: redirect outbound from your SMTP relay to nylas email send, move inbound from your own MX to Nylas's managed mail infrastructure, and run both paths in parallel briefly so you can verify before you shut the old server down.
The payoff is the surface area you stop owning. A self-hosted stack is five systems with their own failure modes; an agent account is one API. The diagram shows the collapse — five boxes on the left, one on the right.
Why migrate off a self-hosted SMTP server?
Running your own mail server means owning its security. According to Postfix's announcement list, the most popular open-source MTA has published 12 security advisories since 2020 — each one a patch, a restart, and a smoke test you schedule. Add TLS certificate rotation, spam-rule updates, and a RFC 5321 wire-format parser, and an agent's mailbox becomes a standing operational burden.
For an autonomous agent, that burden has no upside. The agent doesn't need a mail server; it needs to send and receive. An agent account provisions a working, authenticated mailbox in under 2 seconds, with DKIM signing and spam handling managed for you — the same capability with none of the maintenance. The migration is about deleting infrastructure, not adding it.
How do I map an SMTP send to an agent account send?
Most agents send through a library that speaks SMTP to a relay — a few lines that open a connection, authenticate, and write a MIME message. The agent-account equivalent is one command with no connection, credentials, or MIME assembly. Here's the before and after for a typical script send:
# Before: pipe a message to a local Postfix relay
printf 'Subject: Receipt\n\nOrder #4821 confirmed.' \
| sendmail -f noreply@yourdomain.com customer@example.com
# After: one command from the agent account
nylas email send \
--to customer@example.com \
--subject "Receipt" \
--body "Order #4821 confirmed."The sender address comes from the active grant, so there's no -f envelope-from to set and no relay host to configure. Everything the SMTP path needed — authentication, TLS, DKIM — is handled behind the command. For the full send surface, including templates and attachments, see sending email from the terminal.
How do I handle inbound that used to hit my MX?
If your old server also received mail, you ran MX records pointing at it and a daemon listening on port 25. An agent account replaces both: Nylas manages the MX for the *.nylas.email domain, so inbound lands without any DNS on your side. The agent reads it with nylas email list or reacts in real time to a webhook:
# Inbound arrives at the managed address — read it, no MX to run
nylas email list --unread --json | jq '.[] | {from: .from[0].email, subject}'The agent's address changes from one on your domain to one on *.nylas.email, or your own custom domain if you configure one. To trigger the agent the moment mail arrives instead of polling, register a webhook — covered in triggering agents on inbound email.
What's the cutover plan?
Migrate without a gap by running both paths before you commit. A four-step cutover keeps a working fallback until the new path is proven:
- Provision — create the agent account and confirm it sends and receives with a test message. Under 2 seconds to stand up, so this step is cheap to do early.
- Dual-send — for a window, have the agent send through both the old relay and
nylas email send, comparing delivery and headers. This is your safety net: if the new path misbehaves, the old one still delivers. - Flip — switch the agent's send path to the agent account only, and point any inbound senders at the new address. Watch deliverability and bounce rates for a few days.
- Decommission — once the new path is clean, shut down the SMTP daemon, retire the MX records, and stop rotating the TLS certificate. The maintenance burden goes with it.
Don't skip the dual-send window. It's the difference between a migration you can roll back and a flag day where a delivery problem has no fallback. Keep the old server until the new path has run clean through a full business cycle.
SMTP feature parity
Most of what an SMTP server does, an agent account does for you. The table maps each piece you used to operate to its managed equivalent:
| You operated | Self-hosted SMTP | Agent account |
|---|---|---|
| Outbound send | Postfix/Exim relay | nylas email send |
| Inbound mail | MX records + port 25 daemon | Managed MX, no DNS |
| Authentication | Self-published DKIM/SPF, TLS certs | DKIM and TLS managed |
| Spam filtering | SpamAssassin/rspamd rules | Workspace rules + managed filtering |
| Rate limiting | Daemon config or none | Workspace policy send cap |
What doesn't map one-to-one?
A migration is honest about its edges. A few SMTP setups don't translate directly, and it's better to know before you cut over. If you run elaborate custom MTA routing — milter pipelines, per-recipient rewrite rules, multiple relays with conditional routing — that logic moves into your application code and the agent account's workspace rules, not a config file.
Two other cases to plan for: if you must send from your own domain rather than *.nylas.email, configure a custom domain before the flip so the sender address is right from day one. And if you send very high marketing volume, a dedicated bulk relay may still fit alongside the agent account, which is built for an agent's transactional and operational mail. For where agent accounts sit among the options, see Best Email Infrastructure for AI Agents.
Next steps
- Getting Started with Agent Accounts — the architecture that replaces the five SMTP systems
- Send Email from the Terminal — the full send surface your SMTP path maps to
- Trigger Agents on Inbound Email with Webhooks — the real-time replacement for a port-25 listener
- Custom Domains for Agent Accounts — configure your own domain before the cutover so the sender address is right
- Best Email Infrastructure for AI Agents — when an agent account fits and when a bulk relay still does
- Manage the Agent Account Lifecycle — operate the identity you migrate to
- Full command reference — every
nylas email sendandnylas agentflag - Nylas v3 API documentation — the send and grants APIs behind these commands