For a project, I needed to find some way to purposefully and immediately throw sent messages into the Postfix HOLD queue so they could be released programmatically.
On Debian, you’ll need the
postfix-pcre package, and then:
header_checks = pcre:/etc/postfix/header_checks
And then in
/^X-My-Custom-Header: .*YES/ HOLD
In your application, for applicable messages you can set
X-My-Custom-Header: YES and the messages will immediately go into HOLD.