1

I know i'm doing something stupid here, but I can't figure it out. I'm sending an email using the following:

    $headers  = "MIME-Version: 1.0
    From: ".$from_email."
    Bcc: ".$bcc_email."
    ";
    mail($email, $message['subject'], $message['content'], $headers);

where $from_email = 'no-reply@mydomain.com'

The message is coming through with the wrong from address. full headers below:

 Return-path: <cli@hostxxx.com>
Envelope-to: xxx@email.com
Delivery-date: Tue, 20 Nov 2012 11:01:34 -0500
Received: from cli by cli@hostxxx.com with local (Exim 4.69)
    (envelope-from <cli@hostxxx.com>)
    id 1TaqGI-000232-IJ
    for xxx@email.com; Tue, 20 Nov 2012 11:01:26 -0500
To: xxx@email.com
Subject: Fairway Solutions - Your new password
MIME-Version: 1.0
        From: no-reply@mydomain.com
        Bcc: support@mydomain.com
Message-Id: <E1TaqGI-000232-IJ@host.com>
From: cli@hostxxx.com
Date: Tue, 20 Nov 2012 11:01:22 -0500

Annoyingly, i can see the From coming through correctly, but it's like the received is overwriting with the hosts' info. Am I missing something at a server level?

I've also tried setting it in the php.ini file (ini_set(sendmail_from,no-reply@mydomain.com);) and it's made no difference.

ta

4

1 に答える 1

2

You might try adding addition headers such as the X-Sender:

$headers = 'Content-type: text/html; charset=iso-8859-1' . "\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= "From: $sender<" . $sender . ">" . "\r\n";
$headers .= "X-Sender: $sender<" . $sender . ">" . "\n";
$headers .= "X-Mailer: PHP " . phpversion() . "\n";
$headers .= "X-Priority: 3" . "\n";
$headers .= "X-Sender-IP: " . $_SERVER['REMOTE_ADDR'] . "\n";
$headers .= "Return-Path: $sender<" . $sender . ">" . "\r\n";
$headers .= "Reply-To: $sender<" . $sender . ">" . "\r\n"; 
于 2012-11-20T16:15:47.893 に答える