Suppose that I have some instance running in Amazon EC2:
somehost.example.com
This instance hosts some number of applications or websites for other domains:
www.example.com
web.example.org
etc.
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:
www.example.com
web.example.org
etc.
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:
www-data@somehost.example.com
I can certainly configure Amazon SES to allow mails from somehost.example.com, and I can further add a 'From: "Whoever" <whoever@example.com>'
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. example.com) appears to originate directly from a "something.example.com" server rather than the actual host. I assume this involves creating a hostname.example.com 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.