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 set the reply-to field to the sender of the mail if the recipient matches some addresses. I know I could do a regular expression like this to do this

/^(To|Cc):.*foo@bar.com/ PREPEND Reply-To: bla@example.com

But that would be static, is there a way to set the sender of the message?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

According to http://www.postfix.org/header_checks.5.html you could use Perl Syntax for text replacement e.g.

/^(To|Cc):.*foo@bar.com/ PREPEND Reply-To: ${1}

The puzzle I've left to you is to look up the Perl RE Syntax to retrieve only the email as match.


Update: In your case it's this RegExp:

/^(To|Cc):\s*(\w+@\w+.\w{2,4})/ PREPEND Reply-To: ${2}

share|improve this answer
    
OK that works but if I use ${1} I get to@ as reply to address, ideas? –  plaetzchen Nov 21 '11 at 20:23

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.