I\'m trying to create a php script that will handle a mailing list for me using a mySQL database, and I have most of it in place. Unfortunately, I can\'t seem to get the he
Within a single quoted string, only the escape sequences \' and \\ are replaced by ' and \ respectively. You need to use double quotes to have the escape sequences \r and \n to be replaces by the corresponding characters:
$headers = "From: noreply@rilburskryler.net \r\n";
$headers.= "Reply-To: noreply@rilburskryler.net\r\n";
$headers.= "X-Mailer: PHP/" . phpversion()."\r\n";
$headers.= "MIME-Version: 1.0" . "\r\n";
$headers.= "Content-type: text/html; charset=iso-8859-1 \r\n";
$headers.= "BCC: $emailList";
You could also use an array to collect the header fields and put them later together:
$headers = array(
'From: noreply@rilburskryler.net',
'Reply-To: noreply@rilburskryler.net',
'X-Mailer: PHP/' . phpversion(),
'MIME-Version: 1.0',
'Content-type: text/html; charset=iso-8859-1',
"BCC: $emailList"
);
$headers = implode("\r\n", $headers);