Introduction
What is Optail?
Section titled “What is Optail?”Optail is an open-source email provider abstraction platform. It sits between your application and your email providers (SendGrid, Postmark, Mailgun, Amazon SES), giving you a single API to send transactional email regardless of which provider is delivering it.
Instead of coupling your application to a single email provider’s API, Optail lets you connect multiple providers, define routing rules, and switch between them instantly — without changing a line of application code. Your templates, unsubscribe lists, and delivery metrics live in Optail, not locked inside a provider’s dashboard.
Optail also gives you platform-level control over things that are typically fragmented across providers: email templates with MJML rendering, unsubscribe group management with HMAC-signed links, unified event tracking (delivered, opened, clicked, bounced), and time-series analytics across all providers.
Key Features
Section titled “Key Features”- Provider abstraction — Connect SendGrid, Postmark, Mailgun, and Amazon SES behind a single REST API. Route emails by domain, tags, or priority rules.
- Template engine — Author templates in MJML with Handlebars variables. Version templates, preview with sample data, and roll back to any previous version.
- Unsubscribe management — Create unsubscribe groups, generate HMAC-signed unsubscribe links, and enforce suppressions across provider switches. Suppression state lives in Optail, not your provider.
- Unified metrics — Time-series delivery metrics (sent, delivered, opened, clicked, bounced, complained) with breakdowns by provider, domain, and template.
- Webhook normalization — Receive delivery events from all providers in a single, consistent webhook format.
Architecture
Section titled “Architecture”┌─────────────┐ ┌───────────────────────────────────────────────┐│ Your App │─────▶│ Optail API ││ (SDK/HTTP) │ │ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │└─────────────┘ │ │ Routing │ │Templates │ │ Suppressions │ │ │ │ Engine │ │ (MJML) │ │ & Unsubs │ │ │ └────┬─────┘ └──────────┘ └──────────────┘ │ │ │ │ │ ┌────▼─────────────────────────────────┐ │ │ │ Provider Adapters │ │ │ │ SendGrid Postmark Mailgun SES │ │ │ └──────────────────────────────────────┘ │ └───────────────────────────────────────────────┘ │ ┌───────────────────────────────────────────────┐ │ Webhook Ingester │ │ Normalizes provider events into unified │ │ format, stores in TimescaleDB for metrics │ └───────────────────────────────────────────────┘Tech Stack
Section titled “Tech Stack”| Component | Technology |
|---|---|
| API | Hono on Bun |
| Database | PostgreSQL 16 + TimescaleDB |
| Queue | Valkey (Redis-compatible) + BullMQ |
| Frontend | React 19 + Vite + TanStack Router |
| Auth | Better Auth |
| Monorepo | Turborepo with Bun workspaces |