I have a quick question. How does one add emails to Postfix's queue without it delivering the emails? I am writing a script to email Postfix statistics (queue count, sent, etc) to our support staff. I want to test it when there are emails in Postfix's queue to see if its working correctly. However, every time I send an email from Postfix it gets delivered. :)
Thanks!
I came across this other article before I ended up here.
tl;dr:
Just defer emails to a particular transport, in this case SMTP:
pause delivery:
un-pause delivery:
Mail will queue but not send.
Some methods:
and the best way:
Send it to a valid hostname in a domain you own, that you know doesn't run an smtp server. For example, if you own
server.domain.example
and you know it's not running an smtp server, send them mail to[email protected]
.Postfix will queue it while it tries to talk to the target smtp server.
This assumes you've not configured postfix to send all mail to another relay, but to deliver directly.
And I'm sure there's a better way, to tell postfix to pause delivery, but hey, there's strength in variation.