Postfix Change subject based on recipient

emailpostfix

We are using postfix as a mail relay. I am trying to change the subject of an email based on the recipient address. It looks like check_header is possibly the tool I need but I cant seem to have it filter on recipient but replace on subject.

Best Answer

You probably need a content filter.

The Postfix documentation on builtin filters (which includes header_checks) specifies:

"Header/body checks cannot depend on the recipient of a message."

The difference between a content-filter and a milter is that a milter happens before the queue:

Postfix: content-filter vs. milter

You can use header_checks to send only the recipient-bound emails to the filter in question (to spare postfix the extra work):

How to rewrite email subject in postfix for outgoing mail if From contains specific address?