Einstein47
Programmer
I have been having trouble lately with a form that sends HTML formatted emails. Some people receive the email correctly, while most get a text email with all the HTML tags showing. It makes it really hard to read.
Why do some get the email fine, while others don't?
Here is the code. I pull the To, Subject, and Message from a form (not included - ask and I'll post it). This is the PHP part.
Do I need to have something first - before the MIME-Version line in the headers part? Or is there something I'm missing with the mail() function.
Any help or suggestions is appreciated.
Einstein47
“Evil abounds when good men do nothing.“ - Nelson R.
[[]Starbase47.com]
Why do some get the email fine, while others don't?
Here is the code. I pull the To, Subject, and Message from a form (not included - ask and I'll post it). This is the PHP part.
Code:
$toText = $_POST['toText'];
$msgText = $_POST['msgText'];
$subjectText = $_POST['subjectText'];
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers .= "From: My Email <me@site.com>\r\n";
$headers = str_replace("\r", "\n", $headers);
$headers = str_replace("\n\n", "\n", $headers);
$headers = str_replace("\n", "\r\n", $headers);
$msgText = stripslashes($msgText);
mail($toText, $subjectText, $msgText, $headers);
Do I need to have something first - before the MIME-Version line in the headers part? Or is there something I'm missing with the mail() function.
Any help or suggestions is appreciated.
Einstein47
“Evil abounds when good men do nothing.“ - Nelson R.
[[]Starbase47.com]