Send email from your infrastructure

Self-hosted Resend-compatible API (sending only) powered by AWS SES.

SelfMX is a complete email sending solution that runs on your servers. One command to install, Resend-compatible API (sending only), domain verification with Cloudflare integration, and full audit trail.

Install in one command

Run on any Ubuntu 22.04+ server. Sets up Docker, Caddy, HTTPS, SQL Server, and automated backups.

terminal
curl -fsSL https://selfmx.com/install.sh | bash -s user@your-server-ip

See the installation guide for configuration options and TrueNAS support.

Features

Everything you need to send transactional emails reliably.

Self-Hosted

Full control over your email infrastructure. Your data stays on your servers.

Resend-Compatible API

Drop-in replacement for Resend (sending emails only). Use existing SDKs and integrations.

Powered by AWS SES

Reliable email delivery through Amazon Simple Email Service.

Multi-Tenant

Multiple API keys with domain scoping and rate limiting.

Cloudflare DNS

Optional automatic DNS record creation for domain verification.

Audit Trail

Complete logging of all email activity for compliance and debugging.

Send your first email

After installation, create an API key in the admin UI and start sending.

send-email
curl -X POST https://mail.yourdomain.com/emails \
  -H "Authorization: Bearer re_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "[email protected]",
    "to": "[email protected]",
    "subject": "Hello from SelfMX",
    "html": "<p>Your email content here</p>"
  }'

See the API reference for all available endpoints.

How it works

SelfMX receives API requests, manages domain verification with Cloudflare, and delivers through AWS SES.

┌─────────────────────────────────────────────────────────────────────────────────┐
│                              YOUR APPLICATION                                   │
│                                                                                 │
│    Send email via REST API: POST /emails                                     │
└─────────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       ▼
┌─────────────────────────────────────────────────────────────────────────────────┐
│                              YOUR SERVER                                        │
│  ┌──────────────────────────────────────────────────────────────────────────┐   │
│  │                              SelfMX                                       │  │
│  │                                                                           │  │
│  │   ┌─────────────┐    ┌─────────────┐    ┌─────────────┐                   │  │
│  │   │  Caddy      │───▶│   REST API  │───▶│   AWS SES   │                   │  │
│  │   │  (HTTPS)    │    │   :17400    │    │   Client    │                   │  │
│  │   └─────────────┘    └─────────────┘    └─────────────┘                   │  │
│  │                             │                  │                          │  │
│  │                             ▼                  │                          │  │
│  │   ┌─────────────────────────────────────┐     │                          │  │
│  │   │       SQL Server 2022               │     │                          │  │
│  │   │   (domains, api keys, audit logs)   │     │                          │  │
│  │   └─────────────────────────────────────┘     │                          │  │
│  └──────────────────────────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────────────────────────┘
                                       │
                     ┌─────────────────┴─────────────────┐
                     │                                   │
                     ▼                                   ▼
┌─────────────────────────────────┐   ┌─────────────────────────────────────────┐
│     CLOUDFLARE (Optional)       │   │              AWS SES                     │
│    Automatic DNS management     │   │         Email delivery                   │
└─────────────────────────────────┘   └─────────────────────────────────────────┘