2

I want to configure Postfix to replace the 'From' header in all forwarded/aliased messages with a custom email address, and the 'Reply-To' header with the original sender's address. Is that something that can be done with a simple configuration change, or am I looking at a more complex problem? For example:

Original Message:

From: "John Smith" <[email protected]>
To: "Jane Rice" <[email protected]>

Would get translated to:

From: "My Email Forwarding Service" <[email protected]>
Reply-To: "John Smith" <[email protected]>
To: "Jane Rice" <[email protected]>

Ideally, I would also have it rewrite the message body (adding something about how the message was forwarded for them), but I know that's much more difficult. We have a number of email aliases, and everytime someone reports spam they received through their alias, our server gets flagged. I'm trying to minimize that damage as much as possible.

Any help is greatly appreciated!

1
  • Did you ever learn of a way to solve this? I'm running into a problem and wanted to try to solve it in the same way, but I'm having trouble. My initial attempt was to use header_checks but I learned, as you commented here somewhere, that it only works for one header at a time.
    – bratsche
    Apr 27, 2013 at 21:50

5 Answers 5

1

The right solution is to use standards for that. Either see BATV for Postfix or VERP for Postfix. Where ever VERP is to be preferred.

0

All of this should be reasonable by adding some header_checks logic (see Postfix's header_checks man page), specifically the REDIRECT & REWRITE actions.

You'd want to add something like the following to your main.cf file:

header_checks = regexp:/etc/postfix/header_checks

Then include your regular expressions & actions in /etc/postfix/header_checks.

2
  • It looks like that wouldn't work for two reasons. The first is this:
    – inxilpro
    Oct 18, 2010 at 19:41
  • Oops! The first is this: "Message headers added by the cleanup(8) daemon itself are excluded from inspection. Examples of such message headers are From:, To:, Message-ID:, Date:." The second is the fact that I need to act on multiple headers, and header_checks only works line-by-line.
    – inxilpro
    Oct 18, 2010 at 19:42
0

Don't know if this is of any help, but maybe this post (http://thread.gmane.org/gmane.mail.postfix.user/125861/focus=125866) could be helpful to you.

I can't tell you how to add the additional Reply-To header though...

0

To accomplish your goals (which involve significant message rewriting) you should do one of two things:

  • have postfix move all messages into the hold queue upon receipt, upon which they are mangled by a consumer process and then moved into the incoming queue (this is what MailScanner does)
  • write a Milter for sendmail & Postfix - this lets you do the complicated processing you require inline as the message is received.
0

The header_checks only lets you change the same part you match in the regular expression, at least this is what I see in all configurations.

Example: If you match a regular expression like this

/^Subject: ($1).*        / REPLACE Subject:

You only can change the header SUBJECT, you cant' put a part of the subject in other place of the header.

1
  • Agreed. See my earlier comments on morgant's solution.
    – inxilpro
    Oct 27, 2010 at 12:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .