selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

posthorn logo

Self-host posthorn

v2.0.1

Self-hosted email gateway for transactional mail providers

ReleaseOpen SourceApache-2.0
Updated11 hours ago
LanguageGo
Setup difficultyEasy
Stars
215
CPU
negligible
RAM
~20 MB idle, ~50 MB under load
Storage
minimal
Ports
8080 (HTTP listener for form and API endpoints), 2525 (SMTP listener for inbound SMTP from apps like Ghost, Gitea, Mastodon)
Docker
ghcr.io/craigmccaskill/posthorn
Install with Docker Compose

What is posthorn?

Posthorn is a self-hosted email gateway that connects your self-hosted applications to transactional email providers. It acts as a single outbound mail layer so you don't need to integrate each app separately with external mail services. The software accepts mail through three channels: HTTP form submissions from contact forms, a JSON API for server-to-server calls, and an SMTP listener for apps like Ghost, Gitea, and Mastodon that only speak SMTP. All three channels forward through one of five supported transports. It runs as a single Go binary or Docker container configured with one TOML file. Key capabilities include spam defenses (honeypot, origin checks, rate limits), API key authentication, idempotency for safe retries, Prometheus metrics, health checks, and structured JSON logging. The project is licensed under Apache-2.0.

Should you self-host posthorn?

posthorn scores 49/100 on selfhost.directory (how scoring works) and ranks #61 of 106 in Email. It has 215 GitHub stars.

It shipped 6 stable releases in the past year. The latest, v2.0.1, came out on 29 September 2026. New versions land roughly every 2 weeks.

Setup is easy: most people get it running in one sitting. An official Docker image is available. It is Apache-2.0-licensed and written mostly in Go.

Its closest alternative on selfhost.directory is Formbricks (72/100, 13 179 stars). It scores higher overall, so compare the two before you pick. See posthorn vs Formbricks side by side.

Features

  • AWS SES transport
  • Dry Run Mode
  • Health Checks
  • HTTP API mode
  • HTTP Form Ingress
  • Idempotency keys
  • Mailgun transport
  • Outbound SMTP transport
  • Postmark transport
  • Prometheus Metrics
  • Resend transport
  • Retry policy
  • SMTP listener
  • Spam Protection
  • Structured JSON logging

posthorn README

How to install posthorn

Install posthorn with Docker Compose

Docker Compose
Environment variables
POSTMARK_API_KEY (or other transport API keys)

services: posthorn: image: ghcr.io/craigmccaskill/posthorn:latest restart: unless-stopped volumes: - ./posthorn.toml:/etc/posthorn/config.toml:ro environment: POSTMARK_API_KEY: ${POSTMARK_API_KEY} ports: - "127.0.0.1:8080:8080"

networks: web: external: true

Canonical setup with config mounted read-only, API key via environment variable, port bound to loopback.

posthorn releases & version history

FAQ

Can I hot-reload the config?

Not currently. Config is read once at startup; changes require a restart. A future release may add SIGHUP-triggered reload.

What happens if Postmark goes down?

Posthorn retries once on transient failures (1s delay). If still down, returns 502 and logs the full payload at ERROR level for manual recovery. No persistent queue in v1; v2 adds SQLite-backed retry queue.

Does Posthorn handle file attachments?

Not currently. File attachments are planned for v2 alongside SQLite persistent storage.

Does Posthorn work with Podman?

Yes, the image is a standard OCI artifact that runs rootless as a non-root user on unprivileged ports.

Does Posthorn work with Caddy?

Yes, Caddy as a reverse proxy in front of the Posthorn container is the standard setup.

How much does Posthorn cost to run?

Posthorn itself is free (Apache-2.0). You pay for your transactional email provider (e.g., Postmark free tier ~100 emails/month) and a small VPS (~$5/month).

Can I run multiple Posthorn instances behind a load balancer?

Yes, but each instance has its own in-memory rate-limit buckets so limits apply per-instance, not globally.

What if I want to use SendGrid / Mailgun / Resend / SES instead of Postmark?

Posthorn ships Postmark, Resend, Mailgun, AWS SES, and outbound-SMTP transports out of the box. SendGrid isn't shipped but can be requested via issue.

Why not just use Formspree?

Posthorn is self-hosted with no per-submission pricing, keeps form submissions private, also handles SMTP ingress for apps like Ghost and Gitea, and avoids vendor lock-in.

Is Posthorn related to PostHog?

No. PostHog is product analytics; Posthorn is an email gateway. The name comes from the brass horn historical post riders carried.

Why does my host block SMTP?

Cloud providers like DigitalOcean, AWS Lightsail, Linode, and Vultr block outbound ports 25, 465, and 587 to fight spam and explicitly recommend HTTP API services instead.

What is Posthorn for, in one sentence?

A self-hosted email gateway that gives every app in your stack one shared outbound mail layer pointing at the transactional provider you've already picked.

More in Self-hosting

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…