Php mailer function Question
Posted: Thu Jan 14, 2010 10:02 am
Hey guys,
I've been coding in php for a while now and typically I havent had too many problems with it but currently I am working on a mailer function for a site and I'm up against a wall and I wanted to see if anyone else could help me with this:
I am sending an HTML email to the user after they've answered a few questions, however, when they try to open the email they see all the html tags in it and even though I have the headers set up to send in html. Here is my code:
Can someone point me in the right direction and let me know where I am going wrong? Thank you!
I've been coding in php for a while now and typically I havent had too many problems with it but currently I am working on a mailer function for a site and I'm up against a wall and I wanted to see if anyone else could help me with this:
I am sending an HTML email to the user after they've answered a few questions, however, when they try to open the email they see all the html tags in it and even though I have the headers set up to send in html. Here is my code:
Code: Select all
$emailRecipient = $_POST["email"];
$messageBody = "<html><head></head><body>" . $contactDetails . "<br />" . $benefitsDetails . "</body></html>";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
if (mail($emailRecipient,"American Legion Benefits Summary",$messageBody,"From:American Legion",$headers))
{
echo "Email Successful!";
}
else
{
echo "Error!";
}