SMTP forwarder · Rust · MIT OR Apache-2.0
Mail for your domains, handed to mailboxes you already have.
One static binary. One TOML file. No database, no mailstore, no web interface — mxhop takes a message at the door, works out who it is for, and gives it to Gmail, Fastmail or wherever you already read your mail.
v0.3.0 · everything below is written and tested · one production install so far
$ openssl s_client -starttls smtp -connect mx.example.com:25 -quiet 220 mx.example.com mxhop ready EHLO sender.example 250-mx.example.com greets sender.example 250-SIZE 26214400 250-8BITMIME 250-PIPELINING 250-STARTTLS 250 ENHANCEDSTATUSCODES MAIL FROM:<you@sender.example> 250 2.1.0 sender accepted RCPT TO:<hello@yourdomain.com> 250 2.1.5 recipient accepted DATA 354 go ahead, end with <CRLF>.<CRLF> … the message … 250 2.0.0 delivered as 1795110377370-000003-0007
The reply arrives while the sending server still holds the connection. If the destination refuses it, that refusal is what the sender gets — not a bounce an hour later from an address nobody reads.
Three ways in
Same binary behind all of them. Pick the one that matches how you already run things.
As a binary
Download, check the sum, run it. Nothing to install, nothing to pull. Good for a box you already manage by hand.
curl → sha256sum → run ↗As a system service
systemd unit with socket activation, so port 25 is bound before mxhop starts and it never holds the capability at all.
systemctl enable --now ↗In a container
A scratch image of about 8 MB with no shell inside, for amd64 and arm64. Compose and Swarm files included.
Why it's harder than it looks
Forwarding mail is three lines of code and a decade of edge cases. These are the ones that decide whether your mail arrives.
Forwarding breaks SPF
The message now comes from your server, not the sender's. mxhop rewrites the envelope sender into a domain of yours that is allowed to send (SRS), so the destination's check passes — and it decodes the bounces that come back to that address.
Forwarding breaks DKIM alignment
Unless nothing touches the bytes. mxhop prepends its trace and changes nothing else, so the original signature survives and DMARC still passes. When it cannot, an ARC seal records what this hop found out.
Losing a message is worse than sending it twice
The queue is two plain files per message on disk. A message delivered but not removable from the queue goes out again, deliberately: nothing on disk tells that apart from an attempt that never happened.
The one thing mxhop refuses outright is a forgery. A message whose From: domain publishes p=reject and fails DMARC is turned away at the door, while the sending server still holds it:
550 5.7.1 message from paypal.com fails DMARC and that domain asks for failures to be rejected
Forward it instead and it reaches Gmail with your envelope on it. Gmail refuses it, and the refusal counts against your reputation — every time.
What it writes down about your mail
A forwarder sees every message you receive. What it records is a decision, so here it is in full.
In the log
| queue id | The one thread through every line about a message |
| peer, HELO | The connection's facts |
| envelope | MAIL FROM and the resolved recipients |
| Message-ID | So a line here matches a line in the destination's log |
| size, hops | Counts, never content |
| verdicts | SPF, DKIM, DMARC, and the policy in hand |
| their reply | The destination's own words |
Never, in any line
| Subject | Not in a log line, not in a metric label |
| Body | Not a byte of it |
| Headers | Any the sender wrote, apart from the Message-ID |
This is not a promise in prose. A test reads every logging call in the source and fails the build if one of them would print a message's content — so a length has to be computed and named before it is logged, where a reviewer can see it.
What it won't do
Half the value is in what it is not. If one of these is what you need, mxhop is the wrong tool and you should know that now rather than three pages into the documentation.
- Store your mail. It forwards and forgets. The queue holds only what a destination has not taken yet.
- Serve IMAP. You read your mail where you already read it.
- Send as your alias. Replies come from your real mailbox, not from the domain.
- Filter content. It authenticates identity. A correctly signed message from a throwaway domain is delivered, by design.
- Have a web interface. The queue is plain files you can read with
cat; the operator interface is the filesystem.
Honestly: if your provider can forward mail for you in one setting, it can do this without mxhop and without moving your MX record. This exists for when you want the mail to come through a machine you control.