2

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?

Scott Pack
  • 14,907
  • 10
  • 53
  • 83
plaetzchen
  • 173
  • 1
  • 3
  • 9

1 Answers1

1

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}

acid
  • 26
  • 2