Whenever I send mail via Exim, even if I set a from field, it always says the e-mail is from: apache@server.mydomain.com. Is there any way to make the from field work or at least change the default from address? Thanks.
Exim sends mail from apache@hostname instead of the hostname I’m defining
apache-2.2exim
Related Topic
- Debian – Minimal setting of Exim from Debian 8.0 “Jessie” to work out-of-the-box for receiving mail
- How to have exim on server with multiple domains send each mail from its own domain, not the server hostname
- CentOs 6.8 – Exim 4.72 unable to send email to the root user. Exim error: ** root@: mail domain “” is syntactically invalid
- How to set Exim envelope domain to From domain
Best Answer
Okay, looking at the class you've linked to - you should already be setting the
From:
header which gets you half way there. Chances are that you're seeing the emails coming through look something like this:Which isn't great. It looks confusing to a lot of people and Outlook users also helpfully see such messages tagged as "Apparently From".
This is caused by Exim not permitting Apache (as a system account) from "spoofing" the From address. You can see in line 39 of that class that
sendmail
is called (the Sendmail binary is symlinked to Exim for historical reasons) something like so:This tells Exim to specify the envelope sender address which is by default restricted to UID 0. You can read the intricate details about this from the
-f
section of the Exim man page. In short can change this by permitting Apache to modify the envelope sender inexim.conf
: