Mail Headers
As this server will be hosting quite a few websites, it's rather annoying if all emails sent out have the server hostname in the mail headers. For example, if we set up wibble.com, then it'd be nicer if wibble.com's sent mail showed
Received: from [2.3.4.5] (HELO mail.wibble.com)
rather than the default:
Received: from [1.2.3.4] (HELO server3.myserver.com)
assuming that the server hostname is server3.myserver.com. This also applies to mail received on the server, the domain owner would prefer not to see the hostname, but instead see something like:
Received: by mail.wibble.com with local ..
We fix this by creating two files, one mapping the domains on the server to their IP addresses, and the other mapping the IP addresses to the domains, and making some changes to the exim conf file.
As an example, suppose we are hosting 3 domains:
wibble.com
wobble.com
bobble.com
let wibble.com and wobble.com share an IP address (2.3.4.5) and let bobble.com have it's own IP address (2.3.4.6). The two files, let's name them /etc/virtual/domains_ips and /etc/virtual/ips_domains should then contain:
wibble.com: 2.3.4.5
wobble.com: 2.3.4.5
bobble.com: 2.3.4.6
and
2.3.4.5: mail.wibble.com:mail.wobble.com
2.3.4.6: mail.bobble.com
respectively. Now we need to edit exim's configuration file /etc/exim.conf. Right after the block starting
# Specify your host's canonical name here..
add:
smtp_active_hostname = ${lookup{$interface_address}lsearch{/etc/virtual/ips_domains}{$value}}
smtp_banner = "$smtp_active_hostname server is ready"
Underneath those lines, add:
received_header_text = "Received: \
${if def:sender_rcvhost {from ${sender_rcvhost}\n\t}\
{${if def:sender_ident {from ${sender_ident} }}\
${if def:sender_helo_name {(helo=${sender_helo_name})\n\t}}}}\
by ${lookup{$sender_address_domain} lsearch{/etc/virtual/domains_ips}{$value}} \
${if def:received_protocol {with ${received_protocol}}} \
(Monkeymail Version 1.00)\n\t\}"
Note that we're also pretending our mail server is "Monkeymail Version 1.00" - change this to whatever you like. Now change the remote_smtp section to be:
remote_smtp:
driver = smtp
interface = "${lookup{$sender_address_domain}lsearch{/etc/virtual/domains_ips}{$value}}"
helo_data = "mail.$sender_address_domain"
Now restart exim. These modifications remove the server hostname from the mail headers and replace it with the name of the domain sending the mail. Also, by default, exim now identifies itself as the MTA and version number we specified above.

