NixUser | Unix User | Linux User | NixUser

How to add header subject in postfix


If you want to add subject in the postfix log files, add the following in file at the bottom.


vi /etc/postfix/


header_checks = regexp:/etc/postfix/header_checks
smtp_header_checks = regexp:/etc/postfix/header_checks


And add the lines below in /etc/postfix/header_checks files, create the file if it’s not already there.


/^subject:/ WARN
/^X-PHP-Originating-Script:/ WARN


Now restart postfix server using command:


service postfix restart


Now the subject and the php script / file that is sending emails will be logged to maillog.


You can also add to: and from: the same way.


Add the following to the header_checks file.


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


This is very useful to find the php scripts that are used to send emails from your server or in time of spamming, to find the culprit.