# e2a: Open-Source Email API for Applications and AI Agents

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Source: osrepos.com
Repository profile: https://osrepos.com/repo/tokencanopy-e2a
Generated for open source discovery and AI-assisted research.

e2a is an open-source email API designed for applications and AI agents, offering robust transactional email capabilities and real two-way inboxes. It supports both managed hosting and self-hosting with Docker, providing features like human-in-the-loop approval and advanced content screening. Built in Go, e2a aims to bridge email's universal addressability with the structured data world of AI agents.

GitHub: https://github.com/tokencanopy/e2a
OSRepos URL: https://osrepos.com/repo/tokencanopy-e2a

## Summary

e2a is an open-source email API designed for applications and AI agents, offering robust transactional email capabilities and real two-way inboxes. It supports both managed hosting and self-hosting with Docker, providing features like human-in-the-loop approval and advanced content screening. Built in Go, e2a aims to bridge email's universal addressability with the structured data world of AI agents.

## Topics

- ai-agents
- email-api
- go
- human-in-the-loop
- smtp
- email-automation
- docker

## Repository Information

Last analyzed by OSRepos: Tue Sep 29 2026 01:29:00 GMT+0100 (Western European Summer Time)
Detail views: 1
GitHub clicks: 2

## Safety Notice

OSRepos shares public repositories for knowledge and discovery only. Review source code, dependencies, licenses, and security implications before running or installing anything.

## Content

## Introduction

e2a is an open-source email API for applications and AI agents, enabling transactional email sending and real two-way inboxes. Developed by [Token Canopy](https://tokencanopy.com), it allows agents to interact with email, incorporating human oversight when needed. Whether you're building a simple application or a complex AI agent, e2a provides the infrastructure to send and receive emails with structured data and enhanced security.

This project, written in Go, boasts a strong community with 191 stars and 25 forks, licensed under Apache-2.0. It's designed to be flexible, offering both a managed hosting service at [e2a.dev](https://e2a.dev) and the option to self-host using Docker.

## Why Use e2a and Its Advantages

e2a offers several compelling advantages over traditional email services, especially for AI agents and applications requiring advanced email interaction:

*   **No Public URL Required for Inbound Mail**: Agents can authenticate with their API key and consume inbound mail over a WebSocket, by polling the REST API, or through MCP tools. This is ideal for agents on developer laptops, edge devices, or behind corporate firewalls, eliminating the need for public webhook URLs.
*   **Email Threading on Every Reply**: e2a resolves the RFC `Message-ID`, `In-Reply-To`, and `References` graph within each agent mailbox, emitting correct reply headers and maintaining a server-owned topology identity for message reads. This ensures conversations remain coherent and easily trackable.
*   **Slug Provisioning on a Shared Domain**: Operators can set `shared_domain` and users can immediately register an agent on a shared domain with no DNS configuration, simplifying onboarding.
*   **Built-in Human-in-the-Loop (HITL) Review**: A per-agent protection policy can hold outbound mail in a `pending_review` state. Reviewers can approve via a dashboard, magic-link email, MCP tools, or the API, with configurable auto-expiration policies.
*   **Inbound Content Screening**: Opt-in content scanning flags prompt-injection payloads, jailbreaks, obfuscation, data-exfiltration patterns, and even phishing attempts. Messages are routed to `allow`, `review`, or `block` based on scan sensitivity, providing a critical layer of security for AI agents.
*   **Authenticated Inbound Identity**: Messages expose normalized SPF, DKIM, and DMARC evidence, with an explicit aligned DMARC verdict, ensuring the authenticity of incoming emails.

## Installation

### Self-host with Docker

To self-host e2a, you'll need Docker installed. Follow these steps:

1.  Clone the repository:
    bash
git clone https://github.com/tokencanopy/e2a.git
cd e2a
    
2.  Start the Docker containers:
    bash
docker compose up -d
    
    This will bring up Postgres, the API server, and the dashboard.
3.  Verify health:
    bash
curl http://localhost:8080/api/health
    
4.  Create your first user and API key:
    bash
docker compose exec e2a e2a -config /etc/e2a/config.yaml -bootstrap-email you@example.com
    
    Save the API key, as it's shown only once.

### Connect your agent to hosted e2a

e2a provides quickstart guides for connecting various AI agent frameworks to its hosted service:

*   **Claude Code**: `claude plugin marketplace add tokencanopy/e2a` then `claude plugin install e2a@e2a`
*   **Codex**: `codex plugin marketplace add tokencanopy/e2a` then install `e2a` via `/plugins`
*   **Cursor**: Add the MCP server directly to `.cursor/mcp.json`:
    
{
  "mcpServers": {
    "e2a": { "url": "https://api.e2a.dev/mcp" }
  }
}
    

## Examples

e2a is highly versatile and can be used to build a wide range of AI-powered email applications. Here are some use cases:

*   **AI Support Agent**: Triage customer requests, retrieve context, reply in-thread, and hold sensitive replies for approval.
*   **AI Receptionist**: Answer common inquiries, route messages, and forward conversations to a human team.
*   **AI Scheduling Agent**: Coordinate participants, propose times, and preserve state across multi-turn replies.
*   **E-commerce Agent**: Handle order questions, returns, and coordinate with vendors through persistent email threads.

For complete, runnable examples, explore the [e2a-runbooks](https://github.com/tokencanopy/e2a-runbooks) repository, which demonstrates various use cases with different agent frameworks like Mastra, OpenAI Agents SDK, Claude Agent SDK, LangChain, CrewAI, and Pydantic AI.

## Links

*   **GitHub Repository**: [https://github.com/tokencanopy/e2a](https://github.com/tokencanopy/e2a "e2a GitHub Repository" target="_blank")
*   **Official Website**: [https://e2a.dev](https://e2a.dev "e2a Official Website" target="_blank")
*   **Documentation**: [docs/api.md](https://github.com/tokencanopy/e2a/blob/main/docs/api.md "e2a API Documentation" target="_blank")
*   **Python SDK**: [sdks/python/README.md](https://github.com/tokencanopy/e2a/blob/main/sdks/python/README.md "e2a Python SDK" target="_blank")
*   **TypeScript SDK**: [sdks/typescript/README.md](https://github.com/tokencanopy/e2a/blob/main/sdks/typescript/README.md "e2a TypeScript SDK" target="_blank")