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
.
html tags should be interpreted again
html tags are clearly readable in the text
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
I'm new to this issue tracker so sorry for any inconvenience
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
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.
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.
btw, it neither works with SMTP anymore (don't know if this could make a difference from PHP Mail)
Hi guys,
so do you thik this could be made working again?
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.
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?
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.
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.
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);
Status | New | ⇒ | Needs Review |
I am closing this, The fact that it used to work for you was not by design but by accident
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
|
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 ?