Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to do a simple rewrite (basically, just string replace) in the Subject line for outgoing mail, but only if there is a specific From address in the message. I looked at headers_checks, but I cannot understand how it works when you are dealing with more than one header. It would be helpful if I could process the outgoing mail using the custom script, but I can't find how to do that in postfix.

Any suggestions? Thanks!

share|improve this question

1 Answer 1

up vote 4 down vote accepted

You can do it quite simply (in postfix), header_checks = regexp:/etc/postfix/header_checks is the parameter you need, then in the file /etc/postfix/header_checks add a line like this:

/^From: user@domain.com/ FILTER transport:destination

the transport:destination
line is the most complicated part, the transport is a line you will define in the master.cf, and the destination is where (localhost:port, pipe, etc). You really need to read a bit of the documentation, http://www.postfix.org/FILTER_README.html and http://www.postfix.org/header_checks.5.html will give you a lot more information about how you can pass the mail to your script, as well as the control you can exert over it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.