Log headers & contents of rejected messages via Postfix

Jordan Reiter asked:

I’d like to save the details (headers and contents) of all messages that are rejected when sent out from our server, so I can figure out why they might have been rejected.

Is there any way for postfix to save a message somewhere when it has been rejected?

Forwarding a copy to the root mail account would be fine.

My answer:


Add bounce to your notify_classes directive in main.cf. This will send a copy of all of the message headers to postmaster. (For privacy reasons, Postfix truncates the message body on the copy sent to postmaster.)


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.