bruceg / nullmailer

Relay-only sendmail/qmail/etc replacement MTA
http://untroubled.org/nullmailer/
GNU General Public License v2.0
183 stars 43 forks source link

Send all mail to /dev/null #64

Open micolous opened 4 years ago

micolous commented 4 years ago

Implemented as a protocol handler (like smtp), this would take a configuration option like

anything delete

When operating in this mode, nullmailer would accept mail and always report success, but drop all mail it received on the floor (ie: send to /dev/null).

This would be useful for systems that demand an MTA be installed, but are read-only or the system administrator deliberately wants all mail to be discarded.

Making it an internal option would remove the need to set up a symlink for it, and avoid the need to exec another process.

Alternatives

benbro commented 1 year ago

@micolous did you find a solution for dropping all emails? What happens by default when you don't change any settings and a service tries to send a mail?

micolous commented 1 year ago

@benbro It's been a long time since I've looked at this, but from memory this package has no "default configuration", because you'd normally point this at a "real" mail server.

I was running Debian on a Raspberry Pi, and many packages demanded an MTA be installed. However, I was trying to run the system read only (to preserve the life of the SD card), offline, and generally cut down on any unnecessary background tasks (eg: writing to a mail queue in tmpfs that I'd never read).

The "null" in nullmailer lead me to believe that this might just drop all the mail out-of-the-box, but in fact "null" was referring to the fact it has no local mail queue and immediately forwards messages to some smarthost (ie: external SMTP server).

However, on further investigation, I found nullmailer's "protocol handlers" are just binaries in /usr/lib/nullmailer/ which accept a message and return an exit code, so I ended up using /bin/true as documented above. I don't think that the name localhost actually mattered -- nullmailer passes that as a command-line argument to true (which does nothing with it).

That work-around isn't perfect (for the reasons I opened this issue for), but nullmailer was still a significant improvement over running a fully-fledged MTA. :)

benbro commented 1 year ago

Thanks, I'll use that. I don't understand why debain removed lsb-invalid-mta.