Score:0

Postfix - redirect AND change the To: header

br flag

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

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.