Sending HTML mail
Moderator: General Moderators
Make sure that you include all the headers. Hotmail is picky if it doesn't receive all the headers in the email
Code: Select all
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "X-Priority: 3\n";
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: "".$myname."" <".$myemail.">\n";I should clarify that an email consisting only of HTML will not get automatically flagged as SPAM because of that fact. Say, for example, an email needs a score of 4 to become SPAM. Spam filters will generally (although this is modifiable) give an email a score of 3 based on the HTML.patrikG wrote: So am I. I am no expert on Spam-filters, but flagging an email as spam simply because its HTML would pretty much defeat the purpose of spam-filtering to my mind.
So, while it is possible to send an email only of HTML, you have to make sure your message is personal enough so that it won't get flagged.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
lostboy - thanks, your modified headers solved the Hotmail junk folders problem. However, the e-mail is still not being detected as HTML from Outlook Express. I've been told by a computer researcher friend of mine that Outlook seems to be a bit strange in this respect. Is there any way of solving this however? I have seen HTML e-mails work fine in Outlook, but mine doesn't seem to.
Cheers
Mark
Cheers
Mark
Code: Select all
Mime-Version: 1.0
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit //<---- I just checked the properties on one i just gotCode: Select all
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "X-Priority: 3\n";
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Mailer: php\n";
$headers .= "Content-Transfer-Encoding: 7bit\n";
/* additional headers */
$headers .= 'To: '.$name.' <'.$toadr.">\r\n";
$headers .= 'From: '.$row['Firstname'].' '.$row['Lastname'].' <'.$fromadr.">\r\n";
$headers .= "Cc: ".$cc."\r\n";
$headers .= "Bcc: ".$bcc."\r\n";
ini_set('sendmail_from', $fromadr );
mail($toadr,$subj,$message,$headers);Cheers
Mark
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Not entirely sure here, but try:
Code: Select all
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-MSMail-Priority: Normal\r\n";
$headers .= "X-Mailer: php\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";
/* additional headers */
$headers .= 'To: '.$name.' <'.$toadr.">\r\n";
$headers .= 'From: '.$row['Firstname'].' '.$row['Lastname'].' <'.$fromadr.">\r\n";
$headers .= "Cc: ".$cc."\r\n";
$headers .= "Bcc: ".$bcc."\r\n";
ini_set('sendmail_from', $fromadr );
mail($toadr,$subj,$message,$headers);