- Elixir 98.9%
- Ruby 0.3%
- Shell 0.3%
- Python 0.2%
- CSS 0.1%
|
|
||
|---|---|---|
| assets | ||
| config | ||
| deploy/examples | ||
| dev | ||
| guides | ||
| lib | ||
| priv | ||
| protocol | ||
| rel/overlays/bin | ||
| test | ||
| .credo.exs | ||
| .dockerignore | ||
| .formatter.exs | ||
| .gitattributes | ||
| .gitignore | ||
| .sobelow-conf | ||
| .tool-versions | ||
| .woodpecker.yml | ||
| AGENTS.md | ||
| CHANGELOG.md | ||
| CONTRIBUTING.md | ||
| coveralls.json | ||
| Dockerfile | ||
| LICENSE | ||
| mix.exs | ||
| mix.lock | ||
| README.md | ||
| SECURITY.md | ||
Karta
KAR-tah — Papiamentu for letter.
Karta is a mail platform: an SMTP server and client, a delivery queue, and HTTP APIs for sending mail. It is written in Elixir on Phoenix and Postgres and is meant to be run by a team that wants to own its mail path without running a large legacy MTA. It is a rewrite of Postal.
What it does today:
- Accepts mail from applications over SMTP submission (587 and 465, AUTH
PLAIN, LOGIN and SCRAM-SHA-256 over TLS, or an address range credential
for a client whose address is known) and over five HTTP APIs: its own
(
/api/v2, with an OpenAPI 3.1 document) and APIs compatible with Postal (/api/v1), Mailgun (/mailgun/v3), SendGrid (/sendgrid/v3) and Postmark (/postmark), so existing clients and framework adapters work by changing a base URL and a key. Messages can carry tags and variables, be scheduled up to 72 hours ahead, switch tracking off, and go out in batches of one message per recipient. - Sends only from verified domains, checked on parsed addresses; a domain is verified by a TXT record its owner publishes, and its DNS records (SPF, DKIM, DMARC, MX, reverse DNS, MTA-STS, TLS-RPT, BIMI) are checked every hour, with what to change. DKIM keys are rotated with dual publication; Karta serves domains' MTA-STS policies and BIMI logos (SVG Tiny PS, checked) and can publish its own records through PowerDNS, RFC 2136 dynamic update or a provider of its own.
- Stores message bodies encrypted in S3-compatible storage; keeps secrets hashed or encrypted at rest.
- Receives mail for the addresses that servers route on their verified domains, and passes it on to an application over HTTP (Karta's JSON, the raw message, Postal's two formats, or a Mailgun, SendGrid or Postmark inbound post), to another mail server, or as a forward with SRS and an ARC seal, signed or with an extra header of the organisation's choosing; checks SPF, DKIM, DMARC and ARC and refuses forged senders of domains that ask for it, unless a trusted forwarder vouches for them; refused at SMTP time, never bounced later.
- Delivers with DKIM (Ed25519 and RSA), opportunistic or verified TLS, the recipient domains' MTA-STS policies and DANE records, REQUIRETLS, IP pools (sending addresses that may move between the nodes of a cluster, each with its own HELO name and warm-up plan), limits per destination, retries for 5 days, delivery records, suppression lists, delivery status notifications, and open and click tracking with one-click unsubscribe, on the sending domain's own tracking host if it has one.
- Sends webhooks of what happens to messages (accepted, delivered, deferred, bounced, opened, clicked, unsubscribed) and of DNS problems, 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, so one organisation's requests do not verify with another's), or with an extra header of the organisation's choosing beside the signature; retried for three days and replayable; never to private or special addresses. Applications can manage them with Mailgun's and SendGrid's webhook APIs too.
It also receives and sends the reports mail depends on: DMARC aggregate and failure reports and TLS reports are read, and DMARC aggregate and TLS reports are sent.
Status
Version 1.0.0, the first release (13 November 2026). The features above
are built and tested, were checked by hand on the authors' deployment before
the release, and CI runs the whole suite and a dependency scan on every
change. Karta has been run on one staging deployment of its
authors only: it has sent mail since 8 November 2026 and has received
mail for one test domain since 11 November 2026 (scanned for spam and viruses
since 12 November). It has not carried
production mail for third parties, and nobody outside its authors has run
it yet, so read the Security model and
the installation guide before putting
real mail through it, and expect rough edges. What is missing and what is
planned for 1.1 is in
Status and roadmap; what
changed is in CHANGELOG.md. The optional, off-by-default messaging module
(SMS and WhatsApp) is not proven end to end and is not a stable interface:
see The messaging module.
Documentation
The documentation is in guides/ and is
built into a site with the module reference and the OpenAPI document:
mix docs # output in doc/; open doc/index.html
Start with:
- Overview and Architecture
- Local development
- Installation and the Configuration reference
- Driving Karta from your own system (the Provisioning API for a sign-up or billing system)
- API keys and scopes and the Karta API
- Receiving mail
- The mailbox interface (optional, off by default)
- The messaging module (optional, off by default, not proven end to end)
- Status and roadmap: what was checked, where and when, and what was not
Quick start
Requirements: Elixir 1.20.5 on Erlang/OTP 29.1.2 (.tool-versions, for
mise or asdf), Docker with Compose.
# Local services: Postgres, a validating Unbound with signed test zones,
# Mailpit, rspamd, ClamAV, Garage (S3). See dev/README.md.
docker compose -f dev/compose.yml up -d
dev/garage-bootstrap.sh
mix setup # deps, database, assets
iex -S mix phx.server # http://localhost:4000, /health, metrics on :9568
mix precommit # format, compile, credo, sobelow, audits, tests
Tests run against the compose Postgres (host port 55433). The Local development guide continues from here to a first message in Mailpit.
Container image
docker build -t karta .
# once, and after every upgrade (the server does not migrate):
docker run --rm --read-only --tmpfs /tmp --env-file karta.env karta /app/bin/migrate
docker run --rm --read-only --tmpfs /tmp -p 4000:4000 --env-file karta.env karta
karta.env holds at least SECRET_KEY_BASE, DATABASE_URL, KARTA_VAULT_KEY
and PHX_HOST; a useful installation also needs the message store
(KARTA_S3_*), a validating DNS resolver (KARTA_DNS_SERVER), the SMTP
listeners and a way to sign in. The installation guide walks through them;
deploy/examples/ has Docker Compose and Kubernetes examples for several
replicas.
The image runs as an unprivileged user (uid 10001) from a read-only root.
KARTA_VAULT_KEY is the base64 of 32 random bytes (openssl rand -base64 32)
and encrypts secrets at rest; losing it loses them. See
Installation.
Contributing and security
See CONTRIBUTING.md and SECURITY.md.
License
MIT, Copyright (c) 2026 Shiloh B.V. See LICENSE.