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
You need to modify received_header_text as per the documentation.
This string defines the contents of the “Received:” message header that is added to each message, except for the timestamp, which is automatically added on at the end, preceded by a semicolon. The string is expanded each time it is used.
This can be checked by executing:
exim4 -bP received_header_text
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}"
Ignoring the fact that the use is widespread (googlemail for example) RFC2821 section 4.4 states:
The FROM field, which MUST be supplied in an SMTP environment, SHOULD contain both (1) the name of the source host as presented in the EHLO command and (2) an address literal containing the IP address of the source, determined from the TCP connection.
Mail submission (RFC4409) can be considered to not be “SMTP” in this context so it is not considered to violate this requirement. However, it would be fairly simple to add in a from couplet padded with false data such as localhost or an RFC1918 address.
Note that this only removes the location from the Recieved: header generated by the submission server - the information may also exist in other parts of the header such as Message-Id: header, it depends on the MUA involved.
To refresh the Message-Id for submission mail, one method would be to use a system filter:
if $authenticated_id is not "" then headers remove "Message-Id" headers add "Message-Id: <submit.$message_id@$primary_hostname>" endif
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
http://www.exim.org/exim-html-current/doc/html/spec_html/ch14.html
http://hep.itp.tuwien.ac.at/cgi-bin/info2www?(exim)received_header_text