A WordPress plugin that makes outgoing mail impossible rather than merely unconfigured. One file, no settings screen, nothing written to the database. It is published as open source under GPL‑3.0.
Source, issues and releases: github.com/kostyasorokin/wp-disable-all-email
The problem it solves
A site that cannot deliver mail is not merely quiet. Bots fill its contact and registration forms, the site emails a confirmation to whatever address the bot supplied, and those addresses belong to real people who press “spam”. Bounces pile up behind them and the server’s address ends up on a blocklist — usually noticed when the host writes to ask what is going on.
Stopping the mail daemon does not prevent this. On a typical host the sendmail binary is still there, PHP hands messages straight to it, and it opens its own connection outward. The daemon is off and the mail leaves anyway.
How it works
Two layers, and only one of them ever runs. As a must-use plugin the file loads before WordPress declares its own wp_mail(), so it takes the name first and nothing downstream can send — there is no filter left to remove and no plugin that can outrank it.
If some other must-use plugin got there first, that layer is skipped and a filter stops the core sender instead. The two are complements, not a belt and braces: whichever one is reachable is the one that fires.
What a caller is told afterwards is a choice, set by a constant. Reporting success keeps forms and checkouts finishing normally; reporting failure is the honest answer when there is no other delivery channel, at the cost of showing every visitor an error.
What it cannot do
No plugin can intercept code that calls PHP’s own mail function, opens its own SMTP socket, or posts to a mail API with raw cURL. Those are closed at the server, by disabling the function or by blocking the outbound ports — and if the goal is the reputation of one IP address, that has to be done as well.
Saying so is the point. This closes the WordPress half of the problem and says plainly where the other half lives.
Getting back in
WordPress emails a recovery link when a plugin or theme fails fatally, and stores only a hash of it — so the usable link exists nowhere but in that message. Dropping it silently would leave a broken site fixable over SSH alone.
The plugin rebuilds that link and writes it where it can still be read, and hands it to an action so it can be sent somewhere else instead. It also registers a Site Health entry, because a must-use plugin is easy to forget and “email stopped working” gets investigated from Site Health rather than from the plugin list.
Roles
Developer
Konstantin Sorokin
Work done
- Plugin development, single file with no database writes
- Two-layer mail suppression through pluggable wp_mail and pre_wp_mail
- Recovery-mode link capture, so a fatal error is still repairable
- Site Health check reporting why no mail arrives
- Documentation and open-source release