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