Debug Catch-All Failures by Replaying the SMTP Session
A catch-all email setup looks like the simplest thing in the world until a customer writes to sales@yourdomain.com and gets silence. The domain is configured to accept mail for addresses that do not exist, the MX records point at the right host, and yet messages vanish. The instinct is to blame DNS or the provider. Nine times out of ten, the SMTP transaction itself will tell you exactly where the break is, and you can see it in under a minute by hand.
The trick is to stop guessing and replay the session. Connect to port 25 of the MX host, send MAIL FROM and RCPT TO with the exact local part that failed, and read the reply code. A 250 after RCPT TO means the server accepted the recipient, so the catch-all rule fired and the bug lives downstream in an alias map, a forwarding target, or a mailbox quota. A 550 no such user means the opposite: the catch-all was never applied, and the failed address lookup branch ran instead of the fallback rule. Those two outcomes point at completely different fixes, and most “catch-all is broken” tickets collapse the moment you know which one you have.
What follows is a hands-on procedure for reproducing the failure, interpreting every response code you are likely to see, and tracing the lookup chain after acceptance. Keep in mind that a catch-all is configured on the mail server, not DNS. SPF, DKIM and DMARC govern outbound mail only and have nothing to do with whether an inbound message to an invented address is accepted. Once that distinction is clear, debugging becomes mechanical.
How Catch-All Email Works: Domain-Wide Acceptance vs. Alias and Forwarding Lookups
Catch-all email fails in ways that look identical from the outside: a sender gets a bounce, a customer says “your address doesn’t work,” and someone opens a ticket titled “mail broken.” The fix starts with knowing which of three mechanisms you are actually debugging, because a catch-all, an alias, and a forwarder live at different stages of the same delivery pipeline.
A catch-all email configuration tells the mail server to accept every message sent to a domain, including recipients whose local part matches no real mailbox. Instead of rejecting an unknown address, the server hands the message to a designated fallback mailbox. That recipient address filter is a mail server setting, not a DNS record. MX records route inbound mail to a mail server, and MX host priority decides which server gets tried first, but the decision to accept an invented address like sales-team-2024@example.com happens after the connection lands. The catch-all is configured on the mail server. If DNS points somewhere else, no server-side rule will help.
Here is the control flow that matters when you debug. A standard mail server receives RCPT TO, looks up the local part, and replies with 550 no such user when no mailbox matches. A catch-all rule replaces that failed address lookup branch. The lookup still runs, still misses, and then the server redirects the message to the catch-all mailbox, which collects all unmatched addresses in one place. Two things can break: the server may never reach the catch-all branch (DNS routing to the wrong host, or a server that does not accept unknown recipients), or the branch may fire and the message may die afterward on its way to the collection mailbox.
The catch-all differs from alias, forwarding and disposable addresses, and mixing them up sends you down the wrong log file.
- Alias: an explicit mapping from one address to another. billing@example.com to finance@example.com. The source address must exist as an alias entry. An alias for an address you never created does nothing.
- Forwarding: a rule that takes mail arriving at a real mailbox and relays it to an external destination. The mailbox must exist first, and the relay step adds its own failure modes, including outbound authentication and spam filtering at the destination.
- Catch-all: a domain-wide default. It needs no per-address entry, which is exactly why catch-all domains carry risks of spam to invented addresses. Bots guess local parts, the catch-all accepts them, and the collection mailbox fills with junk.
One point that trips up experienced admins: SPF, DKIM and DMARC govern outbound mail only. They have no say in whether your server accepts a recipient. A DMARC failure on a forwarded copy is a separate problem from a catch-all that never fired, and the two produce different bounce message text.
So before you touch a config file, classify the failure. Did the SMTP session get a 550 on RCPT TO? Then inbound mail acceptance is where the catch-all should have applied and did not. Did it get a 250? Then the server accepted the recipient and the break is downstream, in an alias rule, a mailbox target, or a delivery log. The next step is reproducing the session by hand and reading the exact reply code.
Reproducing the Failure: Connecting to Port 25 and Issuing MAIL FROM and RCPT TO
Most catch-all tickets start with a user saying “mail to anything@ourdomain.com bounces.” Before you touch a single mail server setting, prove the bounce actually happens and capture the exact reply. A manual SMTP session on port 25 gives you that proof in under two minutes, and it splits the problem cleanly in two: either the server rejects the recipient at the door, or it accepts it and loses the message later.
Open a terminal on a machine that is not your mail server (a laptop on a normal network is fine, though many residential ISPs block outbound port 25; if yours does, run the test from a cheap VPS). Use telnet, netcat, or swaks. Start with the plainest option:
- telnet mx1.example.com 25 or nc mx1.example.com 25
- swaks variant: swaks –to anything@example.com –from test@yourdomain.tld –server mx1.example.com –port 25 –quit-after RCPT
Pick the host from your MX records, not from memory. Run dig +short MX example.com and note the MX host priority order. Try the lowest-priority number first (that is the preferred host) and then the next one, because MX records route inbound mail to a mail server, and a catch-all configured on one host may be missing on another. A domain with two MX hosts and a catch-all on only one of them will fail roughly half the time, which explains those “it works sometimes” reports.
When the banner appears (a line starting with 220), type each command and press Enter after every one:
- EHLO test.local – wait for the 250 multi-line reply.
- MAIL FROM:<probe@yourdomain.tld> – expect 250. Use a real, resolvable sender; some servers run sender verification and will answer 550 here, which is a different bug.
- RCPT TO:<anything@example.com> – this is the line that matters. Copy the full reply verbatim.
- QUIT – close cleanly.
Substitute the exact local part from the failing report. If the user typed sales-eu@example.com, test that string, not a made-up address. Case matters on some systems, dots matter on others, and a typo in the ticket is more common than anyone likes to admit.
Record three things: the response code, the enhanced status code if present (for example 550 5.1.1), and the exact text after it. A standard mail server replies with 550 no such user (or 550 5.1.1 User unknown) when no mailbox matches the local part and no fallback rule exists. That single line tells you the catch-all rule is not active on this host, or that it is scoped to a list of recipient address filters that excludes this address. A 451 or 421 means a temporary condition such as a greylist, a full queue, or a policy daemon timing out, so replay in five minutes before drawing conclusions. A 250 means SMTP acceptance succeeded and the unmatched local part was collected as intended; whatever breaks next happens after the handshake, which is the subject of the next step.
Run the identical session a second time against the other MX host and against the IP directly (with the hostname in EHLO) to rule out load-balancer or DNS routing differences. catch-all domain guide provides further background on the subject. Two replays with different answers narrow the fault to a specific server in seconds, and you now hold the bounce message text you will need when you open the delivery logs.
Reading the RCPT TO Response: Why a 250 Means the Bug Is Downstream
The most common misdiagnosis in catch-all troubleshooting is treating a working SMTP acceptance as proof of delivery. It is not. When the server answers RCPT TO with 250, it has only confirmed that the recipient address passed its acceptance stage. Everything after that handshake, meaning the alias expansion, mailbox target resolution, and final delivery, happens asynchronously and can fail silently. If your test session got a 250 and the message still never arrived, the bug is downstream of SMTP acceptance, not in the catch-all rule itself.
Decoding Every RCPT TO Reply You Will See
The response code tells you which layer of the pipeline rejected the address. Read it before touching any configuration.
| Reply | What it proves | Where the bug lives | Next move |
|---|---|---|---|
| 250 | Recipient accepted, catch-all matched or a real mailbox exists | Downstream: alias rules, mailbox lookup, delivery logs | Trace the message ID in the mail log and inspect alias mappings |
| 550 5.1.1 no such user | No mailbox matched and the catch-all rule did not fire | Mail server settings: catch-all disabled, wrong domain, or recipient filter blocking it | Verify the catch-all is enabled for the exact domain and has a valid target mailbox |
| 421 or 450 | Recipient could not be verified at this moment | Greylisting, rate limits, or a temporary lookup failure | Retry after 5 to 15 minutes; check greylisting tables |
| 554 5.7.1 rejected | Recipient exists but policy refused the sender or content | Inbound filtering or recipient address filters | Review blocklists and per-recipient rules |
| Connection refused or timeout | Nothing was accepted at all | DNS routing: MX host priority points at the wrong host, or port 25 is filtered | Re-check MX records and firewall rules before anything else |
A 554 is worth pausing on. It often gets filed as a catch-all failure when the unmatched local part was in fact accepted and then rejected by a recipient filter. The catch-all did its job; the filter undid it.
One myth to retire: SPF, DKIM and DMARC have nothing to do with this decision. They govern outbound mail only. A DMARC failure on your domain cannot cause a 550 on an inbound RCPT TO, and fixing your DMARC record will not make a catch-all accept unknown recipients. If someone tells you the catch-all is broken because of SPF, the session transcript will show otherwise.
Before you move to the next step, confirm you tested the right thing:
- You sent RCPT TO with a local part you know does not exist, not an address that happens to have a real mailbox.
- You connected to the MX host with the highest priority, not a backup host with different mail server settings.
- You quoted the full multi-line reply, including the enhanced status code, not just the first three digits.
- You saved the exact timestamp of the session so you can find the matching queue entry in the log.
With a 250 in hand and a verified unmatched local part, the investigation moves to the alias table and the delivery log. The message was accepted; the question is where the server sent it, and why that destination did not hold.
Tracing the Downstream Lookup: Alias Rules, Mailbox Targets, and Delivery Logs
Where the Message Goes After a 250: Alias Rules and Mailbox Targets
A 250 on RCPT TO tells you the catch-all rule fired and the server took responsibility for the recipient. From that point, the address moves through the lookup chain: catch-all rule, then alias mapping, then mailbox target. The failure is somewhere in that chain, and the logs will name the branch that broke.
Start with the alias table. On Postfix, run postmap -q "anything@example.com" mysql:/etc/postfix/alias.cf or check the static file with postmap -q "anything@example.com" hash:/etc/postfix/virtual. A catch-all entry looks like @example.com catchall@example.com or, in a virtual alias map, @example.com catchall@example.com. If the query returns nothing, the catch-all rule is scoped to the wrong domain or the file was edited without running postmap. On Exim, the equivalent is exim -bt invented@example.com, which prints the router chain and shows whether the catch-all router matched before a more specific router rejected the address.
Then inspect the target mailbox. A catch-all that points at catchall@example.com still needs a real mailbox, a real alias, or a forwarding target. If the target is a forwarding address on another domain, the outbound hop can fail even though inbound acceptance succeeded. That is where outbound mail authentication matters: SPF, DKIM and DMARC govern outbound mail only, and a forwarded message that fails alignment can be rejected by the destination. Check whether the forwarding target exists and whether the relay accepts it.
Reading Mail Logs to Pinpoint the Broken Lookup
The log line is the ground truth. Grep for the message ID from your replay, not the address, because the address will appear several times.
- Postfix:
grep "ABC123" /var/log/mail.logreturns lines liketo=<invented@example.com>, relay=local, status=sentorstatus=bounced (unknown user). A local delivery line proves the catch-all mailbox collected the message. A bounce proves the target lookup failed after acceptance. - Exim:
exigrep "invented@example.com" /var/log/exim/mainlogshows the router that handled the address and the transport that delivered it. - Microsoft 365: use message trace filtered by recipient and status, then check the “Recipient address” and “Message delivered” events separately.
Three patterns cover most cases. First, acceptance followed by a local bounce means the catch-all target does not exist. Second, acceptance followed by a relay failure means the forwarding target is unreachable or rejects the sender. Third, acceptance with no delivery line at all means the message is stuck in a queue or was silently dropped by a content filter.
Confirm the fix with a replay. Open port 25 again, send MAIL FROM and RCPT TO with the same unmatched local part, and expect a 250 followed by a delivery line in the log within seconds. Then test a second invented address to make sure the catch-all rule, not a single alias, is doing the work. If the first address delivers and the second bounces, the rule is too narrow and the catch-all domain is only partially configured.
Keep the replay transcript as a regression artifact, not just a one-off debugging step. Save the exact session (the MAIL FROM, the RCPT TO with the failing local part, the server’s response code, and the timestamp) next to the ticket. When you change an alias rule or a catch-all rule, rerun the same three commands and diff the responses. If RCPT TO returned 250 before the change and still returns 250 after, the SMTP layer is unchanged, so any new bounce points at the downstream lookup you just edited. If it flipped to 550 no such user, the change removed the acceptance branch and the catch-all is no longer configured on the server, even though DNS still points at the same host.
Make the replay the first check for every report of a missing message on the catch-all domain, before you touch MX records or DNS routing. Nine times out of ten the DNS is fine: MX host priority is correct, mail reaches the right server, and the problem sits in a recipient address filter, a stale alias mapping, or a fallback rule that was disabled during a cleanup. The transcript tells you which layer to open in under a minute. One caveat worth repeating to whoever handles the next ticket: SPF, DKIM and DMARC govern outbound mail authentication only. They have no say in whether your server accepts a message for an invented address, so a passing DMARC report will not explain a missing inbound message, and a failing one will not cause it. Replay the session, read the code, then look downstream.
