Forum Moderators: coopster

Message Too Old, No Replies

html mail arriving as text

         

raylittler

1:12 pm on Sep 12, 2005 (gmt 0)

10+ Year Member



I am trying to send an email as HTML using PHP mail() function, but several of the people who have received a mail from me say that its is HTML in text form, not HTML display (ie. Like a web page).

I have checked the headers and I cant see anything wrong.

Is the following OK? if not, what have I done wrong.

<?php
$from = “me@myemailaddress.com”;
$to = “someone@anothieremailaddress.com”;
$subject = “My subject”;

$headers = "MIME-Version: 1.0\n";
$headers .= "From: $from\n";
$headers .= "Return-Path: $from\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\n";

$message = “
<html>
<body>
<p>Hi, This is my message.</p>
</body>
</html>
“;

mail($to, $subject, $message, $headers);
?>

Thanks…

bomburmusicmallet

2:11 pm on Sep 12, 2005 (gmt 0)

10+ Year Member



hi ray, try these lines as header first:

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

and then put the remaining headers, such as from, cc, etc.

let me know how you make out

hth, jenny

raylittler

5:46 pm on Sep 12, 2005 (gmt 0)

10+ Year Member



That seems to have worked.

It's the end of the day here, so I will get my real feedback tomorrow sometime.

Thanks for your help.

Ray...