In postfix header_checks can be used to replace any header. This works for example perfectly for the Message-Id header.
Example:
/Message-Id:\s+<(.*?)@domain-a.com>/ REPLACE Message-Id: <$1@domain-b.com>
Any mail which is processed by postfix will be checked for the Header:
Message-Id: <example@domain-a.com>
and gets replaced with:
Message-Id: <example@domain-b.com>
How does this work with References Header?
Example Header:
References: <mail-1@domain-a.com> <mail-2@domain-a.com> <mail-3@domain-a.com>
Goal:
Replace any (1 - n) occurrence of domain-a.com with domain-b.com in this References header.
Try 1:
#/References:\s+<(.*?)@domain-a.com>/ REPLACE References: <$1@domain-b.com>
(works only with first occurence)
Try 2:
#/<.*?@(domain-a.com)>/ REPLACE domain-b.com
Does not work because header_checks need a valid Header name for the REPLACE command.
Can this replace achived with postfix native header_checks?