Self-hosted email infrastructure for AI agents. Drop in replacement for AgentMail. Unlimited inboxes. Your storage. Your transport.
npm install @autopilot-mail/core # core SDK (required)Skills
npx skills add autopilot-mail/autopilotPick your stack:
# Database
npm install @autopilot-mail/postgres # PostgreSQL
npm install @autopilot-mail/mongodb # MongoDB
npm install @autopilot-mail/sqlite # SQLite
npm install @autopilot-mail/d1 # Cloudflare D1
# Email transport
npm install @autopilot-mail/ses # AWS SES
npm install @autopilot-mail/smtp # SMTP (nodemailer)
# File storage (attachments)
npm install @autopilot-mail/s3 # AWS S3
npm install @autopilot-mail/r2 # Cloudflare R2
npm install @autopilot-mail/archil # Archil
# Standalone server (REST API + CLI)
npm install @autopilot-mail/server # npx autopilotimport { AutopilotServer } from '@autopilot-mail/core';
import { PostgresStorageAdapter } from '@autopilot-mail/postgres';
import { SesTransport } from '@autopilot-mail/ses';
const server = new AutopilotServer({
storage: new PostgresStorageAdapter({ connectionString: process.env.DATABASE_URL! }),
transport: new SesTransport({ region: 'us-east-1' }),
defaultDomain: 'mail.myapp.com',
});
await server.initialize();
// Create inbox
const inbox = await server.inboxes.create({ username: 'support' });
// Send
await server.inboxes.messages.send(inbox.inboxId, {
to: 'customer@gmail.com',
subject: 'Order shipped',
text: 'Your order #1234 has shipped!',
});
// Reply, forward, list threads — same API as agentmail
const { threads } = await server.inboxes.threads.list(inbox.inboxId);Run as a standalone REST API with a TOML config:
npx autopilot --config ./autopilot.tomlcurl http://localhost:3100/health
curl -X POST http://localhost:3100/v0/inboxes \
-H "Authorization: Bearer your-key" \
-H "Content-Type: application/json" \
-d '{"username": "agent", "display_name": "My Agent"}'The REST API is wire-compatible with the official AgentMail SDK. Switch by changing the baseUrl:
import { AgentMailClient } from "agentmail";
const client = new AgentMailClient({
- apiKey: "am_xxx",
+ baseUrl: "https://your-autopilot-server.com",
+ apiKey: "your-autopilot-key",
});
// Everything else stays exactly the same
const inbox = await client.inboxes.create({ username: "support" });
await client.inboxes.messages.send(inbox.inboxId, { to: "user@example.com", subject: "Hello", text: "Hi!" });
const { threads } = await client.threads.list();| AgentMail $20/mo | Autopilot | |
|---|---|---|
| Inboxes | 10 | Unlimited |
| Custom domains | 10 | Unlimited |
| Emails/month | 10,000 | Unlimited (SES: $0.10/1k) |
| Storage | 10 GB | Your DB |
| Vendor lock-in | Yes | No |
| Package | What |
|---|---|
@autopilot-mail/core |
Server, types, in-memory adapters, email utils, webhooks |
@autopilot-mail/postgres |
PostgreSQL storage |
@autopilot-mail/mongodb |
MongoDB storage |
@autopilot-mail/sqlite |
SQLite storage |
@autopilot-mail/d1 |
Cloudflare D1 storage |
@autopilot-mail/ses |
AWS SES transport |
@autopilot-mail/smtp |
SMTP transport |
@autopilot-mail/s3 |
AWS S3 file storage |
@autopilot-mail/r2 |
Cloudflare R2 file storage |
@autopilot-mail/archil |
Archil file storage |
@autopilot-mail/server |
Standalone REST server + CLI |
- Philosophy — why self-host, the cost math, own your data
Getting started
- Getting Started — first install to first email
- Configuration — TOML config reference, env vars
- Server SDK API — full method reference
Adapters
- Storage Adapters — Postgres, MongoDB, SQLite, D1, custom
- Email Transports — SES, SMTP, custom
- File Storage — S3, R2, Archil, local, custom
Deployment
- Standalone Server — REST API + CLI
- Docker — Dockerfile, Docker Compose
- Cloudflare — D1 + R2 + Workers
Guides
- Webhooks — inbound SES + outbound event dispatch
- Testing — in-memory adapters, NoopTransport, assertions
- Examples — runnable code samples
- AWS Setup — SES, S3, SNS, DNS, Postgres
- Cloudflare Setup — D1, R2, Workers, Email Routing
- Migrate from AgentMail — data export, DNS cutover, SDK swap
MIT
