Jump to content

mail() headers error


dflow

Recommended Posts

the following isnt sending mail()

$to=$_POST['CustomerEmail'];	
$from = "[email protected]";
$Cc = "[email protected]";
$headers = "From:" . $from;
$headers = "Cc:" . $Cc;
// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";

i believe it's the dot before the equal sign

Link to comment
https://forums.phpfreaks.com/topic/249736-mail-headers-error/
Share on other sites

$headers = "From:" . $from;  //$headers is now "From: [email protected]"
$headers = "Cc:" . $Cc;        //$headers is now "Cc: [email protected]"
$headers  = 'MIME-Version: 1.0' . "\r\n";  //$headers is now "MIME-Version: 1.0"

 

You're over-writing headers every time.  The concatenation operator (.=) allows you to APPEND headers (though note that \r\n needs to be at the end of every line of the headers).

 

-Dan

 

Link to comment
https://forums.phpfreaks.com/topic/249736-mail-headers-error/#findComment-1281901
Share on other sites

$headers = "From:" . $from;  //$headers is now "From: [email protected]"
$headers = "Cc:" . $Cc;        //$headers is now "Cc: [email protected]"
$headers  = 'MIME-Version: 1.0' . "\r\n";  //$headers is now "MIME-Version: 1.0"

 

You're over-writing headers every time.  The concatenation operator (.=) allows you to APPEND headers (though note that \r\n needs to be at the end of every line of the headers).

 

-Dan

 

roger that

Link to comment
https://forums.phpfreaks.com/topic/249736-mail-headers-error/#findComment-1282092
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.