This is an old revision of the document!
Table of Contents
Exim4 - Remove local username
To remove the local username in the mail headers.
Received: from root by host.domain.com with local (Exim 4.72) (envelope-from <reply@domain.com>) id 123123123 for user@gmail.com; Tue, 03 Jan 2012 13:08:17 +0100
So I want to remove the part with root and the local hostname together(?).
You need to modify received_header_text as per the documentation.
It defaults to:
received_header_text = Received: \ ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\ {${if def:sender_ident \ {from ${quote_local_part:$sender_ident} }}\ ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\ by $primary_hostname \ ${if def:received_protocol {with $received_protocol}} \ ${if def:tls_cipher {($tls_cipher)\n\t}}\ (Exim $version_number)\n\t\ ${if def:sender_address \ {(envelope-from <$sender_address>)\n\t}}\ id $message_exim_id\ ${if def:received_for {\n\tfor $received_for}}
Note the use of quotes, to allow the sequences `\n' and `\t' to be used for newlines and tabs, respectively. The reference to the TLS cipher is omitted when Exim is built without TLS support. The use of conditional expansions ensures that this works for both locally generated messages and messages received from remote hosts, giving header lines such as the following:
Received: from test.example.com ([123.123.123.25] ident=root) by marley.carol.book with smtp (Exim 1.90 #1) id E0tS3Ga-0005C5-00 for cratchit@dickens.book; Mon, 25 Dec 1995 14:43:44 +0000
Received: by test.example.com with local (Exim 1.90 #1) id E0tS3GW-0005C2-00; Mon, 25 Dec 1995 14:43:41 +0000
Note the automatic addition of the date and time in the required format.
This could be modified to something like:
received_header_text = Received: \ by $primary_hostname \ ${if def:received_protocol {with $received_protocol}} \ ${if def:tls_cipher {($tls_cipher)\n\t}}\ (Exim $version_number)\n\t\ ${if def:sender_address \ {(envelope-from <$sender_address>)\n\t}}\ id $message_exim_id\ ${if def:received_for {\n\tfor $received_for}}
or
received_header_text = Received: \ ${if def:sender_fullhost {from ${sender_fullhost}\ ${if def:sender_ident {(${sender_ident})}}}\ {${if def:sender_ident {from ${sender_ident} }}}}\ by ${primary_hostname}\ ${if def:received_protocol {with ${received_protocol}}}\ ${if def:tls_cipher {(tls_cipher ${tls_cipher})}}\ ${if def:tls_peerdn {(tls_peerdn ${tls_peerdn})}}\ (Exim ${version_number} #${compile_number} (Gentoo Linux 1.4))\ id ${message_id}
Alternative Approach
If you wish to remove it from all outgoing messages, then in the options for your “smtp transport” you can use headers_remove with an entry like:
remote_smtp: driver = smtp headers_remove = received