Overview
Karta (KAR-tah, Papiamentu for letter) is an open-source mail platform written in Elixir on Phoenix and Postgres. It accepts mail from your applications over SMTP and HTTP, stores it encrypted, signs it with DKIM and delivers it to the recipients' mail servers, with a retry queue, delivery records, suppression lists and open and click tracking. It is published under the MIT license by Shiloh B.V.
Karta is a rewrite of Postal, the open-source Ruby mail server. It keeps Postal's model of organisations and mail servers and speaks Postal's sending API, so applications that use Postal's client libraries can move by changing a host name and a key. It also speaks the sending APIs of Mailgun and SendGrid, so their official clients and framework adapters work against Karta unchanged.
Early development
Karta is pre-release software. It sends end to end, and it receives mail for routed addresses and checks who sent it (SPF, DKIM, DMARC); with a return path domain it also reads the bounces and complaints that come back. Read Status and roadmap before you plan to run it for real mail.
What Karta does today
Accepting mail from applications
- SMTP submission on port 587 (STARTTLS) and 465 (implicit TLS), with AUTH PLAIN, LOGIN and SCRAM-SHA-256 over TLS only. See SMTP submission.
- Five HTTP APIs, all authenticated with the same API keys:
- Karta's own API at
/api/v2, described by an OpenAPI 3.1 document (Karta API); - Postal's sending API at
/api/v1(Postal-compatible API); - Mailgun's API at
/mailgun/v3(Mailgun-compatible API); - SendGrid's API at
/sendgrid/v3(SendGrid-compatible API); - Postmark's API at
/postmark(Postmark-compatible API).
- Karta's own API at
- Every message, however it arrives, must have its author (From and Sender) and envelope sender at a verified domain of the server's organisation. See Sending rules and limits.
Storing mail
- Message metadata in Postgres; message bodies encrypted with AES-256-GCM (a key per message) in S3-compatible object storage (for example Garage, MinIO or AWS S3).
- A message is acknowledged only after its body and its database row are stored. Retention removes old messages by age and by total size, per server.
Delivering mail
- A delivery queue on Postgres (Oban), one job per message and recipient domain, with MX resolution, IPv4/IPv6 policy, opportunistic or verified TLS, DKIM signing (Ed25519 and RSA), retries with growing delays for 5 days, a per-server send limit, VERP return paths and delivery status notifications. See Delivery, retries and bounces.
- A delivery record for every attempt, readable over every API.
- A suppression list per server (Suppressions).
- Open and click tracking and one-click unsubscribe (RFC 8058), each off until a server turns it on (Tracking and unsubscribe).
- Webhooks of what happens to messages, signed as Standard Webhooks, or in Postal's, Mailgun's, SendGrid's or Postmark's format (Postal's with a key of the organisation's own), or with an extra header beside the signature; retried for three days and replayable; also managed with Mailgun's and SendGrid's webhook APIs (Webhooks).
Running it
- One container image, unprivileged and read-only, configured through environment variables (Installation, Configuration reference).
- A health endpoint, Prometheus metrics on an internal port, and error reporting to any Sentry-protocol service (Monitoring).
How Karta relates to Postal
| Postal | Karta | |
|---|---|---|
| Language | Ruby on Rails, MariaDB | Elixir on Phoenix, Postgres |
| Tenancy | organisations, mail servers | the same |
| Message bodies | in the database | encrypted, in S3-compatible storage |
| Sending API | /api/v1 | /api/v1 (compatible), plus /api/v2, Mailgun and SendGrid APIs |
| Message ids | one message per recipient, integer ids | one message with a row per recipient, UUIDs |
| SMTP AUTH | PLAIN, LOGIN, CRAM-MD5 | PLAIN, LOGIN, SCRAM-SHA-256, over TLS only |
| Queue | its own worker and database queue | Oban on Postgres |
| Web interface | yes | pages for organisations, servers, domains, credentials, messages and webhooks; not yet for routes, suppressions, IP pools and reports |
| Inbound routing | yes | routes to HTTP (Karta's JSON, raw, Postal's RawMessage), SMTP and forwarding endpoints, with SRS; SPF, DKIM and DMARC checked; no ARC or spam scanning yet |
| Webhooks | Postal's format, signed with RSA, retried for about 36 minutes | Standard Webhooks (HMAC with a timestamp), or Postal's, Mailgun's, SendGrid's or Postmark's format; retried for three days, replayable, never to private addresses |
The Postal-compatible API page lists what changes for a Postal client. Karta compared sets Karta's features beside those of Postal, Mailgun, SendGrid and Postmark.
Where to go next
- To try Karta on your machine: Local development.
- To run it: Installation, then Configuration reference and Managing organisations, servers and keys.
- To send mail from an application: SMTP submission or one of the HTTP APIs, starting with API keys and scopes.
- To compare Karta with Postal, Mailgun, SendGrid and Postmark: Karta compared.
- To understand the parts: Architecture.
- To contribute: Development.