0

I'm on Ubuntu Server 12.04 and I managed to install & configure Exim4 following this guide.

I set my hostname to 'multiformeingegno.com' and my /etc/hosts looks like this:

127.0.0.1                           localhost
127.0.1.1                           multiformeingegno
IPv4 ADDRESS                        multiformeingegno.com      multiformeingegno
IPv6 ADDRESS                        multiformeingegno.com      multiformeingegno

I can send mails through PHP just fine. I have 2 questions.

  1. I'm on a VPS and my host is like xxxxx.server.topcloud.it, I'd like to hide this address from my sent mails! I can view it from the tag: Received: from multiformeingegno.com (xxxxxx.server.topcloud.it. [IPv4 ADDRESS]) Is there a way to only display 'multiformeingegno.com' as "received from"?

  2. On my VPS I host multiple sites. How can I change my hostname/fqdn (correct me if I'm using terms unproperly) according to the domain "in use"? For example I have a contact form in my website multiformeingegno.com and another contact form in the other website example.com. How can I have "Return-path", "Received from", etc changing according to the website that's actually sending mails? Is this possible?

3 Answers 3

0
  1. That header is added by the MTA which receives the message from your server. It gets the topcloud.it hostname by doing a reverse lookup on the IP address you used to connect from. The only way to change this hostname is to get your hosting provider to change the PTR record for your IP address.
  2. I don't know specifically about Exim, but it's uncommon to have a mail server change its declared hostname based on the message being sent, so I doubt that you can do this.
  3. The Return-Path is determined by the From address, so this should happen automatically.
1

I have a VPS hosting multiple domains on Ubuntu 14.04 and wanted to make sure the email headers being sent only included the IP or the FQDN of the virtual host.

I first started with this guide on Linode. Afterwards I performed the following steps:

Create a file - /etc/exim4/mailhelo and using the syntax of domain.com: helodomain.com produce something like:

domain1.com: domain1.com
domain2.com: domain2.com
*: defaultdomain.com

Create a file - /etc/exim4/conf.d/01_custom_transport and insert add the following:

REMOTE_SMTP_HELO_DATA = ${lookup{$sender_address_domain}lsearch{/etc/exim4/mailhelo}{$value}{$primary_hostname}}

Edit the file - /etc/exim4/conf.d/30_exim4-config_remote_smtp and add the following to the end of the file:

headers_remove = "received"

Execute

update-exim4.conf
service exim4 restart

Looking at the headers of a web form email, there is no evidence of my VPS host name. Don't forget to create a SPF record for the virtual host with your DNS provider.

0
  1. You cannot hide the address from the sent emails due to the reason described by mgorven: it's added by the mail server which receives the email, not by your mail server.
  2. You can configure exim to change its outbound name (i.e. the name used in EHLO/HELO), and if you have more than one external IP address, you can configure exim to change which outbound IP address it uses in the transport.

Sample transport:

remote_smtp_forwarder:
  debug_print = "Transport: remote_smtp_forwarder for $local_part@$domain"
  driver = smtp
  max_rcpt = 10
  hosts_max_try = 2
  interface = 10.1.2.141
  helo_data = "out.forwarder.iv.ivenue.com"

In this example, the 10.1.2.141 is NAT'd outbound and will connect to your mail server from out.forwarder.iv.ivenue.com (208.89.136.23), and it will issue a "EHLO out.forwarder.iv.ivenue.com" to your mail server. I have mine hardcoded to a specific IP address, but you could also use a lookup to have it determine the interface and the helo_data if you wanted. It depends how much complexity you need.

1
  • And as far as having the correct Return-Path being set, you have to understand the difference between "envelope" From and "header" From. Header From is what you see in the email itself, what your mail client shows. The Envelope From is the actual email address that your mail server uses when it connects and issues the "MAIL FROM" command. Those two (header and envelope) do not have to be the same, and in many cases, they are not. So if you set the correct envelope sender address, the Return-Path will be correct for the person who receives the email.
    – Todd Lyons
    Jun 18, 2012 at 18:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .