Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Whenever I send mail via Exim, even if I set a from field, it always says the e-mail is from: Is there any way to make the from field work or at least change the default from address? Thanks.

share|improve this question
How are you constructing the email - PHP, Python? Can you include a snippet of the code? – Dan Carley Jun 26 '09 at 15:47
I'm constructing it with PHP with this class: – John Jun 26 '09 at 16:11
up vote 1 down vote accepted

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:

From: <>
Sender: <>
Return-path: <>

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:

sendmail -f $fromEmail

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 in exim.conf:

trusted_users = apache
share|improve this answer
Thank you so much! – John Jun 26 '09 at 16:33
No problem. Of course you should be careful of the address that is set, so that users (ie. from web forms) can't forge their own messages and generate backscatter. Or that you might contravene an SPF rule. But you get the idea.. – Dan Carley Jun 26 '09 at 16:41

You want to make sure that the qualify_domain option is set near the top of exim4.conf.

share|improve this answer
That helped a little, but still didn't solve my problem. Now the e-mail says it is from, not – John Jun 26 '09 at 16:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.