AI Mail Exchange

# You give your AI agent a server.
Why borrow someone else's inbox?

The internet's oldest protocol, rebuilt for AI agents.
Your mail, your machine, end to end. No third parties.
Human-friendly setup. LLM-friendly everything else.

Read the book
Join Discord
Check out the code
Quick start
# On VPS with open port 25$curl -fsSL https://aimx.email/install.sh | sh

This launches a guided setup with the following steps:

- Preflight checks on port 25
- Set up domain and DNS
- Set up STARTTLS certificate
- Set up trust policy
- Install AIMX service
- Optionally, wire up MCP for agent(s)

## What’s in the box

- 🔒 You own the inbox. Mail lives on your disk, under your domain. No SaaS relay, no OAuth, no Gmail scanning. MIT licensed.
- ⚡ Mail is an event. Inbound fires `on_receive` the moment SMTP `DATA` completes. Outbound fires `after_send` when the MX attempt resolves. No cron, no heartbeat — push, not poll.
- 📝 Markdown emails. No `.eml`. No database. TOML frontmatter, plain Markdown body. Your LLM reads it without a parser.
- 📬 Direct MTA-to-MTA. Email has become send-and-pray best-effort. AIMX turns it back into direct server-to-server delivery, like an API call.
- 🔌 Built-in MCP. Stdio MCP server ships with the binary. Twelve tools — list, read, send, reply, mark-read, mailbox CRUD.
- 🦀 Single binary. Written in Rust. No runtime deps, no database, no relay. One `aimx setup` command.

## Speaks MCP.

Pre-wired for the following with just a simple `aimx agents setup`:

Claude Code Codex CLI OpenCode Gemini CLI Goose OpenClaw Hermes NanoClaw

Or wire-up any MCP-compatible AI harnesses with the power of self-sovereign email. The options are limitless.

## Why AIMX?

Sending mail through someone else's API is fine until your agent needs to receive a reply, run a hook on it, and own the audit trail. The trade-offs, side by side:

| 🐦‍⬛ AIMX | Gmail / Outlook | SaaS relays SendGrid / Postmark | AgentMail / LobsterMail | Postfix / Stalwart
--- | --- | --- | --- | --- | ---
Built for AI agents | ✅ | ❌ | ❌ | ✅ | ❌
MCP support | ✅local stdio | 🟡via 3rd-party | 🟡via 3rd-party | ✅ext server | ❌
Self-sovereign | ✅ | ❌ | ❌ | ❌ | ✅
Direct delivery | ✅ | ❌ | ❌ | ❌ | ✅
Markdown emails | ✅ | ❌ | ❌ | ❌ | ❌
Free & open source | ✅ | ❌ | ❌ | ❌ | ✅

🐦‍⬛ AIMX

- Built for AI agents✅
- MCP support✅local stdio
- Self-sovereign✅
- Direct delivery✅
- Markdown emails✅
- Free & open source✅

Gmail / Outlook

- Built for AI agents❌
- MCP support🟡via 3rd-party
- Self-sovereign❌
- Direct delivery❌
- Markdown emails❌
- Free & open source❌

SaaS relays SendGrid / Postmark

- Built for AI agents❌
- MCP support🟡via 3rd-party
- Self-sovereign❌
- Direct delivery❌
- Markdown emails❌
- Free & open source❌

AgentMail / LobsterMail

- Built for AI agents✅
- MCP support✅ext server
- Self-sovereign❌
- Direct delivery❌
- Markdown emails❌
- Free & open source❌

Postfix / Stalwart

- Built for AI agents❌
- MCP support❌
- Self-sovereign✅
- Direct delivery✅
- Markdown emails❌
- Free & open source✅

## Design philosophy

AIMX is a mail server for AI agents, not a Postfix replacement. Three principles drive the design:

1. One operator, one domain. No multi-user, multi-domain, or shared hosting. If you need those, run Postfix or Stalwart.

2. Direct MTA-to-MTA delivery. No relay, no submission port, no SaaS in the middle.

3. Markdown on disk. Mail stored as files for LLM-readability, not `.eml` or a database. Attachments are sibling files in a bundle directory.

By design:

- No IMAP or POP3
- No webmail
- No SMTP AUTH
- No retry queues — send either delivers or fails immediately so the agent can react in real time
- No bounces (no DSNs)
- No indexing or search — bring your own RAG

Subject to future improvements. Single-operator is key to the core design philosophy..

## Use cases

### Finance agent

`finance@<YOUR_DOMAIN>`

Forward invoices, receipts, and statements. The agent extracts amounts and vendors automatically.

- Extracts amounts and vendors
- Files attachments to the right folder
- Reconciles against your ledger
- No SaaS scanning your bank data

### Privacy-sensitive

`private@<YOUR_DOMAIN>`

Bank statements, medical records, legal correspondence — mail that shouldn’t sit in someone else’s datacenter.

- No SaaS relay
- No third-party MCP wrapper
- No Gmail scanning the contents
- Mail lives at your server

### Support triage

`support@<YOUR_DOMAIN>`

The agent drafts replies via MCP and escalates when confidence is low.

- Tags by severity, escalates low-confidence cases
- Threading preserved across replies
- Trust gate keeps unverified senders out, unless that's what you want

### Monitoring & alerts

`alerts@<YOUR_DOMAIN>`

Datadog, GitHub Actions, and cron jobs page this mailbox; the agent decides what to do.

- `on_receive` hook: wake you, file a ticket, or self-remediate, decided by AI
- Trust gate keeps spoofers out
- Push, not poll — fires the moment SMTP `DATA` completes
- Markdown body is grep-able for post-mortems

### Newsletter digest

`news@<YOUR_DOMAIN>`

Collect Substack, arXiv, and HN digests; nightly job ships one summary.

- One summary instead of 40 unread threads
- Markdown + frontmatter is RAG-ready out of the box
- Trust gate filters out spammy lookalikes
- Attachments (PDFs, papers) saved as sibling files

### Knowledge-base ingest

`kb@<YOUR_DOMAIN>`

Forward anything in. AIMX saves them in Markdown + TOML frontmatter and be RAG-ready.

- RAG-ready Markdown + TOML on disk
- Attachments extracted as actual files
- Per-mailbox ownership keeps multi-agent setups partitioned

## Demo

A quick look at AIMX wired up to Claude Code
Mailboxes, MCP, and hooks firing on real inbound email.

## FAQ

Why does AIMX need port 25 open?

AIMX is your mail server. SMTP runs on port 25. It has been defined and set in RFC 821 since 1982. AIMX speaks SMTP directly to other mail servers, no third-party relays involved. Your mail stays truly private and secure.

Can I switch AIMX to operate on another port?

No. SMTP operates strictly on port 25 as defined and set in RFC 821 since 1982. Other mail servers will only deliver to you on 25.

Can I run AIMX on my home server?

Yes, as long as you have globally accessible port 25. Home ISPs typically block port 25. To check if port 25 is open without installing AIMX, run `curl -fsSL https://aimx.email/portcheck.sh | sh`.

What AI models does AIMX support?

All of them. AIMX does not call AI models directly. It is a mail server with a stdio Model Context Protocol (MCP) server built-in, so your AI harnesses and agents can connect to it easily and effectively.

How do I set up email accounts on AIMX?

Once AIMX is set up, mailboxes can be created with the `aimx mailboxes` CLI, or via the `mailbox_create` MCP tool by simply instructing your AI harness in plain natural language, such as `Create a receipt@ mailbox and file receipts for me when you receive them`.

Can I run AIMX without owning a domain name?

No. You need a domain to define how emails are delivered to you (`MX` record) and verified (`DKIM` TXT record). Email specifications (RFC 5321 §5.1) require the MX record to point to a domain name, not an IP. Subdomain is fine too.

Why do I need AIMX when I can just use Gmail + MCP?

You can, if you do not mind your emails being stored and accessible on both Gmail servers AND third-party MCP servers. If you are on a free Gmail account, you might also be violating Gmail’s ToS. Besides, it is a lot of work to create multiple mailboxes for separate agentic use.

Why do I need AIMX when I can just use MCP-enabled AgentMail or LobsterMail?

You can, if you do not mind your emails being stored and accessible on third-party servers. Besides, credit card is required.

How are emails stored on AIMX?

AIMX stores all incoming and outgoing emails as Markdown files with TOML frontmatter. This makes them trivially easy for AI agents, RAG pipelines, and LLMs to read and parse, no MIME decoding required. Attachments are extracted and stored on disk in native format.

Does AIMX have any automation? How does AIMX prevent prompt injection from incoming emails?

Yes, AIMX supports hooks that fire on incoming mail, but only from senders you trust. You define the trusted sender list. AIMX verifies every incoming message with DKIM and records the result in the frontmatter, so your agent always knows whether a message is authenticated. Mail that fails DKIM, or arrives from an unverified sender, will not trigger any hooks.

More? Browse the full FAQ in the book.

## Ready to try AIMX?

Simple human-friendly setup, powerful LLM-friendly everything else. Got questions? Join the AIMX Discord.

Get started
Join Discord