Postfix: log warning subject from and to

How to log subject in /var/log/maillog to identify easy mail.
It comes in handy when you need to debug an email issue and need to confirm your mailserver has sent the message.

Edit file /etc/postfix/header_checks  and insert this:

/^subject:/      WARN
/^to:/           WARN
/^from:/         WARN
/^Subject:/      WARN
/^To:/           WARN
/^From:/         WARN

You have to add header_checks = regexp:/etc/postfix/header_checks in /etc/postfix/

postmap  /etc/postfix/header_checks

After this restart postfix services.

/etc/init.d/postfix restart


systemctl restart postfix.service

Leave a Reply

Your email address will not be published. Required fields are marked *

3 + 7 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.