Self-hosted email sending platform with a Resend-compatible API, powered by AWS SES.
Documentation · Getting Started · Development
SelfMX provides a drop-in replacement for Resend's email API that you can self-host. It handles domain verification, DNS record management (via Cloudflare), and email delivery through AWS SES.
Key Features:
- Resend-compatible API (
POST /emails) - Automatic domain verification with DNS management
- Multi-tenant API keys with domain scoping
- Admin dashboard for key management and audit logs
- Automatic SSL via Caddy
- Daily backups with retention policies
- SQL Server database for production reliability
curl -fsSL https://raw.githubusercontent.com/aduggleby/selfmx/main/deploy/install.sh | sudo bashThe installer will:
- Install Docker and dependencies
- Deploy SQL Server 2022 container
- Prompt for configuration (domain, AWS credentials, admin password)
- Set up automatic SSL certificates
- Configure daily backups
- Start SelfMX as a systemd service
- Ubuntu 22.04+ server (4GB RAM minimum for SQL Server)
- Domain name pointed to your server
- AWS account with SES access
- (Optional) Cloudflare account for automatic DNS management
-
Configure DNS: Point your domain to the server IP
dig your-domain.com @8.8.8.8
-
Access Admin UI:
https://your-domain.com/admin/login -
Create API Keys: Generate keys scoped to specific domains
-
Send Email:
curl -X POST https://your-domain.com/emails \ -H "Authorization: Bearer re_your_api_key" \ -H "Content-Type: application/json" \ -d '{ "from": "[email protected]", "to": "[email protected]", "subject": "Hello", "html": "<p>Hello from SelfMX!</p>" }'
# View logs
docker compose -f /opt/selfmx/docker-compose.yml logs -f
# Restart services
sudo systemctl restart selfmx
# Manual backup
sudo selfmx-backup
# Restore from backup
sudo selfmx-restore selfmx_20260126_030000.bak
# Update to latest version
curl -fsSL https://raw.githubusercontent.com/aduggleby/selfmx/main/deploy/install.sh | sudo bashselfmx/
├── src/SelfMX.Api/ # .NET 9 backend
│ ├── Endpoints/ # API route handlers
│ ├── Services/ # Business logic (SES, Cloudflare, DNS)
│ ├── Jobs/ # Hangfire background jobs
│ ├── Entities/ # EF Core models
│ └── Authentication/ # API key auth, rate limiting
├── tests/SelfMX.Api.Tests/ # xUnit tests
├── client/ # React frontend (Vite + TanStack Query)
│ ├── src/pages/ # Page components
│ ├── src/components/ # UI components
│ └── src/hooks/ # React Query hooks
├── website/ # Documentation site (Astro)
├── deploy/ # Deployment files
│ ├── install.sh # One-line installer
│ └── docker-compose.yml # Production compose file
├── docker-compose.dev.yml # Development SQL Server
├── build.csando # Ando build script
├── ando-pre.csando # Pre-hook (cleanup, auth)
├── Dockerfile # Multi-stage Docker build
└── mise.toml # .NET 9 version pinning
# Clone and setup
git clone https://github.com/aduggleby/selfmx.git
cd selfmx
mise install # Installs .NET 9
# Start development SQL Server
docker compose -f docker-compose.dev.yml up -d
# Run backend (terminal 1)
dotnet run --project src/SelfMX.Api
# Run frontend (terminal 2)
cd client && npm install && npm run dev- Backend: http://localhost:17400
- Frontend: http://localhost:17401 (proxies API to backend)
- SQL Server: localhost:17402 (sa / Dev@Password123!)
- mise - manages .NET version
- Node.js 22+
- Docker - for SQL Server and full builds
Ando provides reproducible builds in Docker containers.
# Build and test everything
ando
# Full release: build, test, push Docker image to ghcr.io, deploy docs
ando --dind -p publish
# Validate build script
ando verifySelfMX implements the Resend API for email sending.
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check |
/system/status |
GET | System status (AWS, DB connectivity) |
/system/version |
GET | API version and build info |
/system/logs |
GET | Application logs (admin) |
/emails |
POST | Send email |
/domains |
GET | List domains |
/domains |
POST | Add domain |
/domains/{id} |
GET | Get domain |
/domains/{id} |
DELETE | Delete domain |
/domains/{id}/verify |
POST | Trigger verification check |
/domains/{id}/test-email |
POST | Send test email |
/api-keys |
GET | List API keys |
/api-keys |
POST | Create API key |
/api-keys/{id} |
DELETE | Revoke API key (admin) |
/sent-emails |
GET | List sent emails (admin) |
/sent-emails/{id} |
GET | Get sent email details (admin) |
/audit |
GET | Audit logs |
/hangfire |
GET | Background jobs dashboard (admin) |
See full documentation for details.
No'Sassy - Free to use, modify, and distribute. Cannot be offered as a competing SaaS.