v2.0.12026-09-29
Fixed
- The webhook transport's documented headers table was rejected at config load with "unknown field(s)". The strict unknown-field check didn't look inside nested tables under a transport's free-form settings, so a documented, supported setting failed to parse. Keys under transport.settings are now left to the transport's own validation; typos anywhere else are still rejected. (#123)
v2.0.0 — Gateway reliability2026-09-29
The v2.0 work — the stateful shift, recut 2026-08-02 against the integration-seam USP (unsubscribe injection and fan-out moved out behind demand gates; see the roadmap). Everything below is opt-in: a config without the new blocks behaves identically to v1.2.
Added
- HTML email bodies (#5, ADR-19). Per-endpoint bodyformat = "html": the body template renders through html/template with contextual auto-escaping, so submitter input is inert markup by construction. Plain-text part auto-derived from the rendered HTML (or supply textbody); multipart delivery on all five transports; existing file-based HTML templates work directly via body = "templates/x.html". The SMTP listener now accepts HTML mail — text/html maps through, and HTML-only messages (previously rejected 554) are accepted with a derived text part.
- Storage spine (#21, #22, ADR-20/21). Optional [storage] block: SQLite (pure-Go driver; static builds unchanged) submission log, sync-first retry queue — 200 still means sent; api-mode callers get 202 {"status":"queued"} where v1.x dropped mail after inline retries, and queued sends survive restarts with exponential backoff. Durable idempotency (byte-identical replays across restarts). Retention pruning, a hard maxsize cap so Posthorn can never fill its own disk, and a storage canary in /healthz + posthornstorage_healthy; storage failure degrades to v1.x behavior — mail never blocks on the disk.
- Lifecycle events + suppression (#8, #4, ADR-22/23). [lifecycle] enables a basic-auth-protected Postmark event sink; events normalize to a provider-agnostic shape and forward, HMAC-signed, to per-endpoint webhook_urls with retry. Hard bounces and spam complaints auto-suppress globally; suppressed sends answer 200 {"status":"suppressed"} / SMTP 250 (terminally handled — never retried). Managed via the new posthorn suppressions list|add|remove CLI; no HTTP admin API.
- Webhook transport (#23, ADR-24). type = "webhook" delivers the structured submission (id, envelope, bodies, raw fields) as a signed JSON POST — same retry classification and queueing as mail.
- File attachments (#24, ADR-25). Opt-in [endpoints.attachments] with a required allowed_types allowlist enforced on the sniffed bytes, never the declared type. Form-mode multipart files and api-mode base64 attachments; carried by all five mail transports.
- New metrics: queue counters/gauges, lifecycle event/forward counters, posthornsuppressedrecipients_total.
Fixed
- Outbound SMTP can now announce an operator-configured hostname in EHLO/HELO via hello_hostname, allowing relays that reject the default localhost identity.
- Multipart form fields were silently dropped in v1.x — multipart/form-data submissions never delivered their values to validation, spam checks, or templates. Form parsing is now content-type-aware.
- SMTP listener metrics are now recorded before the DATA reply is written, so a /metrics scrape taken on the client's acknowledgement reflects the send. Previously the counter could lag the reply by a few microseconds. (#119)
- The SMTP listener now decodes Content-Transfer-Encoding (quoted-printable and base64) before mapping text/plain and text/html parts, so mail from senders that encode their bodies (listmonk, most mail clients) no longer arrives with raw =3D escapes or base64 blobs. (#113)
Security
- Doctrine, spec-level (NFR25): security-relevant features are opt-in, never default-on. The lifecycle event endpoint cannot run unauthenticated; attachments require an explicit type allowlist; storage requires an explicit block.
- Release images are built with Go 1.26.8. The v2.0.0-rc.3 image failed the release Trivy gate on eight HIGH Go standard-library CVEs in the previous builder pin (Go 1.26.5; fixed upstream in 1.26.6). The builder was bumped and v2.0.0 is cut from v2.0.0-rc.4.
v1.2.0 — Spam protection2026-07-05
Spam-protection minor. Adds three content-agnostic checks that target automated contact-form spam — the kind that fills valid-looking fields, varies its wording and language, and reuses throwaway sender addresses, so there's no content signature to match. All are opt-in, form-mode only, and backwards-compatible; existing configs are unaffected.
Added
- Reputation check (#44). Optional [endpoints.reputation] — a StopForumSpam lookup on the submitter email and/or IP before send, blocking known form-spam identities regardless of message content or language. Bounded LRU result cache; fails open by default so a provider outage never blocks real mail (fail-open events increment posthorncheckfailedopentotal{check="reputation"}). Sends email+IP to a third party — opt-in.
- Proof-of-browser check (#45, ADR-18). Optional [endpoints.proofofbrowser] — Posthorn serves a challenge token from a GET on the endpoint that only page JavaScript can fetch and inject as pobtoken, blocking bots that POST the form directly. An optional min_age time-trap rejects impossibly-fast submissions. No third party; works on static sites.
- Captcha check (#33). Optional [endpoints.captcha] — Cloudflare Turnstile verification, the escalation tier for bots that render a real browser. Byte-identical silent 200 on a rejected token; fails closed by default on a provider outage.
- New posthorncheckfailedopentotal{endpoint,check} metric and spamblocked kinds reputation / proofof_browser / captcha.
Changed
- The three spam checks (origin, honeypot, CSRF) were refactored into a two-phase pipeline (#60): header checks pre-parse, form checks post-parse, each producing a spam.Verdict the handler renders through one mapping. No behavior change — the extraction is what let the three new checks land as small additions rather than more inline blocks.
Fixed
- The SMTP ingress was constructed with a nil metrics recorder, so posthornsubmissionssenttotal{endpoint="smtplistener"} and its failure counter never emitted. The registry and recorder are now shared with the HTTP mux, and the real send latency is recorded (was hardcoded 0). (#57)
- posthorn validate now builds the SMTP ingress, so a listener config with a semantic error (e.g. requiretls with no tlscert) is caught at validate time instead of failing at boot. (#58)
Recipes
- Added Authentik and Mastodon SMTP-listener recipes to the docs site.
---
Image: ghcr.io/craigmccaskill/posthorn:1.2.0 (multi-arch, cosign-signed, SBOM + provenance attested). Validated via v1.2.0-rc.1 before GA.
v1.1.0 — Security hardening & operational maturity2026-07-05
A security-hardening and operational-maturity release, from a full audit of the shipped v1.0. One breaking change (below) that closes an open-relay footgun; everything else is additive or a fix.
Breaking
- authrequired = "none" on a public bind is now refused at config-parse time (#41). An SMTP listener with authrequired = "none" whose listen address is not verifiably loopback/private (e.g. :2525, 0.0.0.0:2525, a public IP, or an unresolvable hostname) is a startup error. Set trustednetwork = true to assert the listener is reachable only from a trusted network — a Docker bridge with no ports: exposure, a VPN, or a firewall. Migration: deployments built from the pre-existing Ghost / Gitea / internal-relay recipes used authrequired = "none" with listen = ":2525" and must add trusted_network = true (the updated recipes include it). This closes the open-relay footgun where the sender allowlist was the only gate on an unauthenticated public listener.
Added
- SMTP listener brute-force and resource hardening (#50). Per-remote-IP AUTH-failure budget (10 failures/minute; further attempts get 421 and the connection closes; successful auths never consume budget). Global (maxconnections, default 100) and per-IP (maxconnectionsperip, default 16) concurrent-connection caps; over-cap connections get a 421 before any protocol work.
- CSRF rejections now increment posthornspamblocked_total{kind="csrf"} — previously they were log-only and invisible on /metrics.
- spamblocked (honeypot and origin) and csrfrejected log lines now carry clientip for operator forensics, matching ratelimited; omitted when stripclientip = true (FR59).
Fixed
- An [smtp_listener]-only config (no [[endpoints]]) is now accepted — the config validator required at least one HTTP endpoint, breaking the documented Ghost and Gitea recipes and every SMTP-listener-only deployment. posthorn validate output now names the listener so a listener-only config doesn't report a bare "0 endpoint(s)". (#37)
- SMTP-listener sends now honor the FR19-22 retry policy — a transient provider error is retried once (as the HTTP ingress already did) instead of returning an immediate 451. Previously a provider blip could drop a transactional email on the SMTP path that the HTTP path would have retried. The retry policy is now shared between both ingresses. (#59)
- The HTTP server now sets ReadTimeout (15s) and WriteTimeout (30s, chosen to exceed ReadTimeout + the handler's 10s request bound so a legitimate slow upload followed by a provider retry isn't truncated after the mail was sent) plus an explicit 64 KB MaxHeaderBytes, so slow-body senders and slow-reading clients can't hold connections indefinitely. (#42)
- Raw stdlib parse errors are no longer echoed to clients on malformed bodies; both parse paths return a generic 400 and log the detail server-side as bodyparsefailed. Deliberate API-shape messages (e.g. "nested objects are not supported") remain client-visible. (#42)
Security & supply chain
- CI now runs a gofmt gate, govulncheck, and golangci-lint on every push and pull request. (#38)
- Docker base images are pinned by digest, and Dependabot keeps the base images, Go modules, and GitHub Actions current. (#39)
- Release images now ship SLSA provenance and SBOM attestations, are signed with cosign (keyless via GitHub OIDC), and are gated on a Trivy vulnerability scan. (#56)
Development
- New hermetic provider-testing harness (core/providertest): ingress→egress end-to-end tests for all five transports and the SMTP listener, run on every PR with no credentials. A make test-live runner and a scheduled, protected workflow validate against real provider APIs (against non-delivering targets; SES via OIDC, no stored key). See #76. Posthorn deliberately does not test deliverability/DKIM — the provider owns signing and reputation.
---
Image: ghcr.io/craigmccaskill/posthorn:1.1.0 (multi-arch, cosign-signed, SBOM + provenance attested). Validated via v1.1.0-rc.1 before GA.
v1.0.0 — Initial release2026-05-26
Posthorn is the unified outbound mail layer for self-hosted projects — one gateway between your apps and your transactional mail provider.
One container. One TOML config. One set of credentials. Apps point at Posthorn, Posthorn points at your provider.
Highlights
- Three ingress shapes — HTTP form (contact forms on static sites), HTTP API with Bearer auth + idempotency (server-to-server callers), and an SMTP listener (Ghost, Gitea, Mastodon, Matrix, NextCloud, Authentik — anything that only speaks SMTP, including on cloud hosts that block outbound 25/465/587).
- Five transports — Postmark, Resend, Mailgun, AWS SES, and outbound-SMTP relay. Provider is a config field; switching is one line and a container restart.
- Bespoke clients, no SDKs — every transport is a 200–300-line stdlib HTTP client. Three external dependencies in the entire Go module: a TOML parser, a UUID library, an LRU cache.
- Security primitives in by default — structured-JSON header construction (submitter input can't become headers), honeypot 200s that are byte-identical to real successes, fail-closed Origin checks, bounded-memory token-bucket rate limiter, per-IP brute-force defense on API endpoints, API keys that are header values only and never logged.
- Operational surface — \/healthz\, \/metrics\ (hand-rolled Prometheus exposition, no \prometheus/clientgolang\ dep), structured JSON logs with UUID submission IDs and \transportmessageid\ for jumping to the provider's UI, dry-run mode, CSRF tokens, IP-stripping, named \trustedproxies\ presets.
Get it
\\\bash
docker pull ghcr.io/craigmccaskill/posthorn:v1.0.0
\\\
Multi-arch image: \linux/amd64\ + \linux/arm64\.
Ten-minute walkthrough from \docker compose up\ to a working contact form: posthorn.dev/recipes/contact-form.
What's not in v1.0
No persistent storage — a send that exhausts both retries is gone except for the log line. Durable retry across restarts is on the roadmap. Suppression lists, lifecycle webhooks, HTML body, attachments → all v2.
Links
- Docs: posthorn.dev
- Quick start: posthorn.dev/getting-started/quick-start
- TOML reference: posthorn.dev/configuration/reference
- Design principles: posthorn.dev/design-principles
- Roadmap: posthorn.dev/roadmap
- Full changelog: CHANGELOG.md
Apache-2.0. Bug reports and feature requests: Issues.