I created a script that sends an email to the user when they register.

The email code is:

$return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody,1);

But the result is:

 <p>&lt;html&gt;<br />&lt;head&gt;<br />&lt;/head&gt;<br />&lt;body&gt;<br />testing<br />&lt;/body&gt;<br />&lt;/html&gt;</p>

What's required for the correct output?

  • have you tried using ->html(false)?
    – Lodder
    Oct 26, 2015 at 9:14
  • @lodder5 ,only used true Oct 26, 2015 at 9:52
  • i get data from xml form field , an editor field, is it the error? Oct 26, 2015 at 9:53
  • No No, I mean try using JFactory::getMailer()->html(false)->sendMail(...);
    – Lodder
    Oct 26, 2015 at 10:21
  • it seems ,Call to undefined method JMail::html() error Oct 26, 2015 at 10:31

1 Answer 1


You just need to decode the entities before passing it to the email.

Something like:

$html = html_entity_decode($emailBody); 

or better still

$html = html_entity_decode($emailBody, ENT_QUOTES); 

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.