0

I want to redirect messages with postfix if they are sent from a specific sender. The redirect should be visible in the To: field. For the redirect I tried to use this header_checks rule:

/^From:.*sender@example.com.*$/ REDIRECT new-target@example.com

This works and the message is redirected to new-target@example.com. But the To: header still points to target@example.com. How can I change the To: header as well?

To be more specific: The system is sending mails from different senders to different targets and I only want to redirect one of them.

Here are some typical combinations of from/to pairs that happen on this server:

From: sender@exmaple.com  -> To: target@example.com
From: sender2@exmaple.com -> To: target@example.com
From: sender3@exmaple.com -> To: other@example.com

I only want to redirect sender@exmaple.com -> To: target@example.com to another target and change the To: field as well. The others should remain the same. How can I do this?

If I add another header_checks rule to match To: target@example.com then it will also change the To: field for sender2.


Related Questions

Postfix: how to redirect a single email address depending on the sender This deals with how to do a check based on the recipient. I don't care about the recipient, I want to always change the To: field.

conditional rewrite of mail from matching recipient domain in postfix only deals with the From: field

postfix rewriting sender with generic & header_check again, only deals with the sender

masgo
  • 433
  • 1
  • 4
  • 12

0 Answers0