0

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 '15 at 9:14
  • @lodder5 ,only used true – Mathesh Raj Oct 26 '15 at 9:52
  • i get data from xml form field , an editor field, is it the error? – Mathesh Raj Oct 26 '15 at 9:53
  • No No, I mean try using JFactory::getMailer()->html(false)->sendMail(...); – Lodder Oct 26 '15 at 10:21
  • it seems ,Call to undefined method JMail::html() error – Mathesh Raj Oct 26 '15 at 10:31
2

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); 
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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