I Built a Lightweight SMTP-to-Mailgun Bridge in Go (In Just Two Days)
Description and use
Mailgun Passport is a lightweight SMTP‑to‑Mailgun bridge written in Go that lets legacy SMTP‑only applications send mail via Mailgun without installing a full MTA.
Problem
Legacy applications that only speak SMTP cannot send mail through modern providers that block outbound port 25.
Outcome
Mailgun Passport enables legacy SMTP clients to send mail through Mailgun in a lightweight, secure, and production‑ready way, eliminating the need for a full MTA.
Workflow
- 1. Run Mailgun Passport locally on 127.0.0.1:587.
- 2. Send SMTP messages to the local server (e.g., via swaks).
- 3. Passport parses the raw SMTP envelope and MIME body.
- 4. It reconciles envelope recipients with MIME headers, treating missing recipients as Bcc.
- 5. Passport forwards the message to Mailgun’s /v3/{domain}/messages endpoint via HTTP.
- 6. Systemd runs the service as a dedicated low‑privilege user with sandboxed capabilities.
Evidence
If you've ever tried to plug a legacy application, an old monitoring script, or an enterprise tool into a modern email delivery service like Mailgun, you've probably hit a brick wall: your app only speaks SMTP, but many cloud providers block outbound port 25 entirely.
Mailgun Passport, a minimal SMTP-to-Mailgun bridge written in Go.
It already supports native RPM/DEB packaging, structured logging, flexible configuration via .env or systemd, and dual parsing/MIME modes.
- Record date: 2026-10-24T09:11:18.549Z