Sending mail from multiple hosts on one instance using Amazon SES and Exim4

futureal asked:

Suppose that I have some instance running in Amazon EC2:

This instance hosts some number of applications or websites for other domains:

This host is configured to use exim4 to interface with Amazon SES for sending mail. In Amazon SES, each domain is separately allowed as a valid sender:

However, as one would expect, the FQDN of the instance and the executing user are being used as the sender of each email, so all emails appear to originate from:

I can certainly configure Amazon SES to allow mails from, and I can further add a 'From: "Whoever" <>' envelope to the emails at the application level.

What I am wondering is, (a) is this an acceptable solution, and if not, (b) what configuration might I explore to show that mail for each domain (e.g. appears to originate directly from a “” server rather than the actual host. I assume this involves creating a DNS entry and pointing it to the server, but beyond that I am lost in how to set up exim or the application to allow this.

My answer:

Are you trying to hide the fact that the email originated from an EC2 instance? The short answer is, you can’t. The Received: headers will contain a reasonably complete trace of the email’s path through the network. Fortunately for you, almost nobody ever looks at them.

If you just want recipients to see something reasonable for the From: header, then just put something reasonable in the From: header when you send the email.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.