Monday, May 18, 2009

How to filter messages by Subject in Postfix

In Postfix in the main.cf file there is an entry for “header_checks = regexp:/etc/postfix/header_checks”

Under /etc/postfix/ edit the header_checks file
Here is an example of a header_checkes file with a filter:
##############################################
/^Subject:.*canceled: local event error/ DISCARD
/^Subject:/ WARN
##############################################
The line /^Subject:.*canceled: local event error/ DISCARD - will deleted without notice to the sender or sending server and log the action in the log file.

The line /^Subject:/ WARN will write the Subject of each message to the log file. This is handy when trying to find a specific message.

No comments: