Text/html email sending
Posted: Fri Sep 03, 2004 8:49 am
Hi,
I'm creating a newsletter system that I want to send emails in html/text format so most people can read it, I'm currently using:Which works, but is it the correct way of doing it in your opinions? How would you do it differently?
Also doing it like this, when it goes to an email address that is protected by spamassassin, spamassassin complains of "MIME_MISSING_BOUNDARY,MSGID_FROM_MTA_SHORT" what does this mean? and how can I get it not complain of this (to shave a couple of spam points off the score) - the protected email address receives html email from others and it dosen't complain of those errors on theirs.
I've checked the source of their emails and can't see any difference between theirs and mine.
Thanks
I'm creating a newsletter system that I want to send emails in html/text format so most people can read it, I'm currently using:
Code: Select all
$headers = "From: our company <newsletter@ourcompany.tld>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$boundary = uniqid("==companyname");
$headers .= "Content-Type: multipart/alternative" .
";\r\n boundary="$boundary"\r\n\r\n";
// text version
$headers .= "--$boundary\r\n" .
"Content-Type: text/plain; charset="ISO-8859-1"\r\n" .
"Content-Transfer-Encoding: 7bit\r\n\r\n";
$headers .= chunk_split("This is the text based version");
// html version
$headers .= "--$boundary\r\n" .
"Content-Type: text/html; charset="ISO-8859-1"\r\n" .
"Content-Transfer-Encoding: quoted-printable\r\n\r\n";
$headers .= chunk_split("<html><head><title>test</title></head><body><font color="#0066ee">this is the html version</font></body></html>");
$headers .= "--$boundary";
// send message
mail("customer@e.mail", "Newsletter...", "", $headers);Also doing it like this, when it goes to an email address that is protected by spamassassin, spamassassin complains of "MIME_MISSING_BOUNDARY,MSGID_FROM_MTA_SHORT" what does this mean? and how can I get it not complain of this (to shave a couple of spam points off the score) - the protected email address receives html email from others and it dosen't complain of those errors on theirs.
I've checked the source of their emails and can't see any difference between theirs and mine.
Thanks