On Mon, Oct 06, 2014 at 02:08:42PM +0200, Bata Degen wrote:
> I am sending mail from a PHP script. I have checked that it's really
> sent by Exim. The From-Header I add in the script is, I guess,
> overwritten by Exim. The scripts looks like this (excerpt).
>
> $headers = "From: Display Name <do-not-reply@???>\r\n";
> $headers = "Content-Type: text/plain; charset=\"utf-8\"" . "\r\n";
You overwrite your "From:" header field by the second PHP assignment.
The $headers variable must be appended, not overwritten.
> $subject = "=?UTF-8?B?".base64_encode("The subject")."?=";
> if(mail("testaccount@???",$subject,"TEST",$headers)){
> echo "true";
> } else {
> echo "false";
> }
>
> It works BUT the From-Header is overwritten to something like this:
> From: www-data <www-data@???>. The domain3.com is also legit on
> this server but not the domain I want to be used.
"From:" field is added by Exim, because it is absent on submission.
> Above all, I need to know from where Exim possibly retrieves domain
> names. I've already checked /etc/mailname and /etc/hostname. They are
> IMHO okay!
On Debian-based distributions /etc/mailname is used by default.
But it may be set explicitly somewhere in configuration file.
--
Eugene Berdnikov