Trying to get my mass mail script to function with ckeditor and send out nice fancy emails. I am close but I still dont quite have it. Now it will send emails and use things like bold and italics, but no colors or anything else. Not sure where to look, but here is a look at some of my code, I found some of it from other sources trying to help with this situation, but its the closest I have come. I think it would have something to do with charset or something similar? Pretty new to php in general. while ($row = mysqli_fetch_array($result)){ $email = $row['email']; $to = $row['email']; $random_hash = md5(date('r', time())); $headers = "From: info@mywebsite.com\r\nReply-To: info@mywebsite.com"; $headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\""; ob_start(); ?> --PHP-alt-<?php echo $random_hash; ?> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit <?php echo $message; ?> --PHP-alt-<?php echo $random_hash; ?> Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 7bit <?php echo $message; ?> --PHP-alt-<?php echo $random_hash; ?>-- <? PHP:
put Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 7bit into $message and use normal html format in $message
Icreated this functions its easy and better: function sendHTMLemail($HTML,$from,$to,$subject,$bcc) { // First we have to build our email headers // Set out "from" address $headers = "From: $from\r\n"; //bcc $headers .= "Bcc: $bcc\r\n"; // Now we specify our MIME version $headers .= "MIME-Version: 1.0\r\n"; // Create a boundary so we know where to look for // the start of the data $boundary = uniqid("HTMLEMAIL"); // First we be nice and send a non-html version of our email $headers .= "Content-Type: multipart/alternative;". "boundary = $boundary\r\n\r\n"; $headers .= "This is a MIME encoded message.\r\n\r\n"; $headers .= "--$boundary\r\n". "Content-Type: text/plain; charset=utf-8\r\n". "Content-Transfer-Encoding: base64\r\n\r\n"; $headers .= chunk_split(base64_encode(strip_tags($HTML))); // Now we attach the HTML version $headers .= "--$boundary\r\n". "Content-Type: text/html; charset=utf-8\r\n". "Content-Transfer-Encoding: base64\r\n\r\n"; $headers .= chunk_split(base64_encode($HTML)); // And then send the email .... mail($to,$subject,"",$headers); } PHP: