J3 Issue ?
avatar joit
joit
6 Jul 2016

Steps to reproduce the issue

before J! 3.5 it used to be possible to style language strings with <strong> etc. Nice for the activation email COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY_NOPW etc.
Now this isn't possible anymore. Only line breaks are possible with \n\n.

Expected result

html tags should be interpreted again

Actual result

html tags are clearly readable in the text

System information (as much as possible)

PHP Built On SunOS localhost 5.10 Generic_142901-13 i86pc
Database Version 5.5.48-log
Database Collation utf8_general_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 5.5.36
Web Server Apache/2.2.31 (Unix)
WebServer to PHP Interface cgi-fcgi
Joomla! Version Joomla! 3.5.1 Stable [ Unicorn ] 05-April-2016 22:45 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36

Additional comments

I'm new to this issue tracker so sorry for any inconvenience

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
5.00

avatar joit joit - open - 6 Jul 2016
avatar JoomliC
JoomliC - comment - 6 Jul 2016

Do you have tested override with HTML tag only in this string, or with other string as well ?

I can confirm that HTML tags not allowed in COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY_NOPW for this email body (maybe an expected behavior...), but i confirm too that HTML tags are still working in other translation strings.

In which joomla version (before you upgrade to 3.5.1) it was possible to use HTML in this string : COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY_NOPW ?

avatar joit
joit - comment - 7 Jul 2016

I just tested HTML tags on other strings and that works.

With 3.4.8 and earlier it was possible to add HTML tags on COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY_NOPW

avatar mbabker
mbabker - comment - 7 Jul 2016

JMail::sendMail() defaults to not sending in plain text, code that calls it has to explicitly set a flag to use HTML mode. The method using that string to send mail messages doesn't set this flag so it'd be expected behavior that the message is sent in plain text. Now, if the JMail class code didn't change, and the code in the user registration model didn't change, it may be a change in the PHPMailer class that caused it, and at a quick glance of the diff from PHPMailer 5.2.9 to 5.2.14 I don't see any behavior change here.

avatar mbabker
mbabker - comment - 7 Jul 2016

It actually may have been this commit that changed it. But considering the default values all define the mode as plain text, this should not have introduced a behavioral change.

avatar joit
joit - comment - 7 Jul 2016

btw, it neither works with SMTP anymore (don't know if this could make a difference from PHP Mail)

avatar joit
joit - comment - 11 Jul 2016

Hi guys,

so do you thik this could be made working again?

avatar mbabker
mbabker - comment - 11 Jul 2016

So here's the thing. com_users never explicitly supported sending messages in HTML format. It still doesn't. All of the default options are set to plain text and there isn't anything being called in that context that instructed PHPMailer to use HTML format. With that said...

Looking at PHPMailer's changelog, something sticks out to me as the possible reason why it may have worked before but no longer does. See PHPMailer/PHPMailer@127d26e where the old class that used to convert HTML to plain text was removed due to a licensing conflict with the library. I don't know if that's the exact culprit or not, I'm having a hard time finding a trace that would lead to PHPMailer::html2text() being called, which is the cleanup function used internally by PHPMailer. Inside the library it gets called if you call PHPMailer::msgHTML() but there are no internal calls to that in PHPMailer or our extended JMail class either.

All this to say I don't know why it worked before because the code at no point ever explicitly set HTML mode, but that may be a reason why it doesn't work now.

avatar joit
joit - comment - 12 Jul 2016

ok, so there's a license conflict. This probably makes it difficult.
Do you think it makes sense to mark html in activation emails as a feature request?

avatar mbabker
mbabker - comment - 12 Jul 2016

Well for Joomla, there's less of a license conflict. The library in question is GPL and since PHPMailer is LGPL it caused the conflict. Part of the problem is to restore the behavior we have to understand how the method is getting triggered and just on code analysis I haven't gotten that far and haven't had time to debug otherwise. If we can sort that out we can probably add that helper back and use it in our extended JMail class to make things "work".

Note the emails would most likely still send with a plain text configuration, but it seems that library did a pretty darn good job of converting HTML strings to text messages that work in that configuration so it might be enough to get by for that use case.

avatar joit
joit - comment - 13 Jul 2016

Well, unfortunately I don't understand too much of the technical background. But do you think I can hope that this could work in a future version of Joomla? Otherwise I'd look for an extension to do this.

avatar SuperFra
SuperFra - comment - 4 Aug 2016

If you want to force sending mail in HTML you can add true as the sixth parameter to the function sendMail in components/com_users/models/registration.php

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

avatar joomla-cms-bot joomla-cms-bot - change - 4 Aug 2016
The description was changed
avatar joomla-cms-bot joomla-cms-bot - edited - 4 Aug 2016
avatar franz-wohlkoenig franz-wohlkoenig - change - 6 Apr 2017
Status New Needs Review
avatar brianteeman brianteeman - labeled - 25 Mar 2018
avatar brianteeman
brianteeman - comment - 10 Apr 2018

I am closing this, The fact that it used to work for you was not by design but by accident

avatar brianteeman brianteeman - change - 10 Apr 2018
Status Needs Review Closed
Closed_Date 0000-00-00 00:00:00 2018-04-10 12:58:13
Closed_By brianteeman
Labels Added: J3 Issue
avatar brianteeman brianteeman - close - 10 Apr 2018

Add a Comment

Login with GitHub to post a comment