2

I have a form that will dynamically send emailers . This form takes the email id of the recipient ,the subject and the body content.

I am using PHPMailer class to go about this. When it comes to plain text ,the emailers work just fine. But I want to add a functionality where the users can paste html into the body part so that the emailer can parse/read them and send the html'ized version of the emails.

I tried this , but it didn't work as the the entire HTML was mailed as text.

$email_msg = htmlentities($_POST['mail_msg'], ENT_QUOTES, "UTF-8");

Any advice would be helpful .

Thanks in advance.

1
  • Content-type: text/html? Commented Mar 7, 2014 at 7:46

2 Answers 2

5

Did you set the PHPMailer default to HTML:

$mail->IsHTML(true); 
Sign up to request clarification or add additional context in comments.

Comments

0

Modify your mail headers :

$header  = "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html; charset: utf8\r\n";

2 Comments

Thank you for responding..the above solution helped and worked.
It's okay, it's better anyway. I'm being old I need to read php doc again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.