Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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):.* PREPEND Reply-To:

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

share|improve this question
up vote 2 down vote accepted

According to you could use Perl Syntax for text replacement e.g.

/^(To|Cc):.* 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


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.