How to modify Receive header in Postfix
Each Mail Transport Agent that encounters a message adds a Receive
header to indicate where, when, and how the message arrived and also some data about the receiver. When I send an email from Mac Mail.app MUA, my Postix MTA adds:
Received: from mycomp-mbp.domain_not_set.invalid (cpe-MY-PERSONAL-IP.dynamic.ISP.net [MY-PERSONAL-IP]) by mydomain.com (Postfix) with ESMTPSA id 71F1D5C551 for <[email protected]>; Fri, 1 Feb 2019 11:17:45 +0100 (CET)
I feel like I am giving to much personal information to strangers I respond. How can I configure Postfix, so that it will replace my IP address, mycomp-mbp.domain_not_set.invalid
and possibly my ISP provider. Any data here can be prepared in advanced without some repalce magic, apart from this line: ESMTPSA id 71F1D5C551 for <[email protected]>
(receiver is dynamic) and IP address of my server (sometimes it uses IPv4, other times IPv6).
I edited /etc/postfix/main.cf
to contain a line that triggers header checks:
postconf -e "header_checks = pcre:/etc/postfix/header_checks"
so it now all boils down to creating the right instruction.
I would appreciate any tip.
Example header_checks
:
/^Received:.*with ESMTPSA/ IGNORE
/^X-Originating-IP:/ IGNORE
/^X-Mailer:/ IGNORE
/^Mime-Version:/ IGNORE
/^User-Agent:/ IGNORE
Removes all routing and MUA information.