Hi there, I’m currently in the process of revising the contents of a newsletter that is generated from a PHP script. I’m using a multipart/alternative MIME type. It was working fine before, but suddenly it is not showing up correctly when being sent. It just show the entire code. So I end up getting the mime information and both the plain and html message (with source code showing) displayed when the email is sent.
[CODE]–Multiparta09988018a
Content-Type: text/plain; charset=”utf-8″
….. Information that doesn’t matter …..
–Multiparta09988018a
Content-Type: text/html; charset=”utf-8″
<html>
<head>
<style type=”text/css”>
….. css stlyes …..
</script>
</head>
<body>
….. Information that doesn’t matter …..
</body>
</html>
–Multiparta09988018a–
[code=php]//set boundary
$boundary = “Multipart” . substr(md5(date(“c”)),0,10);
//set headers and subject
$headers = “From: …@….comrnReply-To: …@….comrnMIME-Version: 1.0rnContent-Type: multipart/alternative; boundary=” . $boundary . “rn”;
//set body
$body = “–$boundaryrnContent-Type: text/plain; charset=”utf-8″rn
$bodyTextrn
–$boundaryrnContent-Type: text/html; charset=”utf-8″rn
$bodyHTMLrn
–$boundary–rn”;
//mail
mail($to,$subject,$body,$headers);