STOP! FREEZE!
Every so often I find myself wondering how to convince Postfix to hold all mail passing through, so I can make a test that won’t embarrassingly bounce off the next hop. I can never remember how I did it the last time.
header_checks = static:HOLD
This is probably the simplest solution for turning Postfix into a dark-gray hole. It will hold absolutely all (valid) messages that arrive via the SMTP server or are created locally.
To let them go again:
mailq | fgrep \! | cut -d\! -f 1 | postsuper -H -
A ! appended to the queue ID indicates that the message is in the
“held” queue.
Individual messages are deleted with
postsuper -d (queue_id)
, i.e. the ID without the !.