Question

So I have the script sending a multipart email of plain text and html, some reason the plaintext version is not working, but I can see that it is sending when I show original in gmail. It just shows the html though when I click message garbled?

// headers
$headers = "MIME-Version: 1.0\r\n";
$headers .= 'From: From Name  <'. FROM_EMAIL. ">\r\n";
$headers .= 'To: '.$member->member_info['memem']. "\r\n";
$headers .= 'Bcc: receipts@gmail.com' . "\r\n";
$headers .= "Subject: Registration Receipt\r\n";
$headers .= "Content-Type: multipart/alternative;boundary=" . $boundary . "\r\n";


// Additional headers
 $message . "\r\n\r\n--" . $boundary . "\r\n";
 $message .= "Content-type: text/plain;charset=utf-8\r\n\r\n";

 $message .= $receipt_txt;//plain text

 $message .= "\r\n\r\n--" . $boundary . "\r\n";
 $message .= "Content-type: text/html;charset=utf-8\r\n\r\n";

 $message .= $receipt_html;//html

 $message .= "\r\n\r\n--" . $boundary . "--";




mail( $member->member_info['memem'], 'Registration Receipt', $message, $headers );
Was it helpful?

Solution

Crap. I found it. "$message . "\r\n\r\n--" . $boundary . "\r\n";" should be "$message .= "\r\n\r\n--" . $boundary . "\r\n";" I feel dumb :(

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top