I would like to add a tag to all email messages sent to a particular address. I have tried to copy examples from the web, but can't seem to get it working.
Here's what I've done so far:
-
Add to /etc/postfix/transport
email@example.com rewrite:
-
Add to /etc/postfix/master.cf
rewrite unix - - n - - smtp -o header_checks=pcre:/etc/postfix/rewrite_headers
-
Create /etc/postfix/rewrite_headers containing
/^Subject: (.+)$/i REPLACE Subject: [Example tag] $1
Where am I going wrong?
Best Answer
You should be able to do this without a custom transport, using built-in header checks.
Add to main.cf:
Your
rewrite_headers
file will have the existing rule wrapped in a conditional:This should handle everything without the need for a transport config.