Some times it is advisable to change/hide some message headers in outgoing mail. For example, you don't like that helo string with your internal domain is shown in Received: header or when it appears in MUA's generated Message-id
Fixing Received header
Changes to Received header string can be made via received_header_text variable. This string is expanded each time it is used:
received_header_text = "Received: \
${if def:sender_rcvhost {from ${if match {$sender_rcvhost}{.*DOMAIN_PATTERN_HERE.*} {localhost}{$sender_rcvhost}}\n\t}\
{${if def:sender_ident {from ${quote_local_part:$sender_ident} }}\
${if def:sender_helo_name {(helo=${if match {$sender_helo_name}{.*DOMAIN_PATTERN_HERE.*} {localhost}{$sender_helo_name}})\n\t}}}}\
by $primary_hostname \
${if def:received_protocol {with $received_protocol}} \
${if def:tls_cipher {($tls_cipher)\n\t}}\
id $message_id\
${if def:received_for {\n\tfor $received_for}}"
Fixing Message-id
To change Message-id i added system filter with the following contents:
#/etc/exim4/filter.conf
if not first_delivery then
finish
endif
if error_message then
finish
endif
if "${if def:h_Message-Id {yes}}" is yes and
$h_Message-Id matches "@.*DOMAIN_PATTERN_HERE.*" then
headers remove Message-Id
headers add "Message-Id: <${message_id}@$primary_hostname>"
endif
This filter should be specified in exim's configuration with:
system_filter = /etc/exim4/filter.conf









