phpemaildebianexim4

Configuring exim's outgoing e-mail address


I forgot how I set it. I have two websites and I send the e-mail through my second site. Here's my /etc/exim4/passwd.client file:

*.google.com:noreplyn@firstsite.com:password
*.google.com:noreply@secondsite.com:password

I'm sending mail through PHP's mail() function with the following headers:

$headers = 'From: no-reply <noreply@secondsite.com>' . "\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Reply-To: noreply@secondsite.com' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";

But I am getting this header on my client's email:

from:    no-reply firstsite.com
reply-to:    secondsite.com
to:  apathetic012@gmail.com

How do I properly set a custom outgoing e-mail address for exim?

PS: I'm using a smarthost (Google apps)


Solution

  • Set your envelope From.

    mail($recipient, $subject, $body, $headers, '-f noreply@secondsite.com');