User tests: Successful: Unsuccessful:
This creates the ability to make the User component send HTML emails instead of plain text.
We can override the registration and activation email bodies via the language overrides. However, any html markup does not work in the current Joomla release.
This PR adds a Send As HTML
option in the Users global configuration to allow html in these email bodies:
When you switch the Send As HTML
on, all emails not using html will still work.
The plain text email bodies use \n
for new lines. These will be converted to <br />
tags (if no other html closing tags are found).
To test this, create a language override for one of these language strings (depending on your settings):
COM_USERS_EMAIL_REGISTERED_BODY
COM_USERS_EMAIL_REGISTERED_BODY_NOPW
COM_USERS_EMAIL_REGISTERED_NOTIFICATION_TO_ADMIN_BODY
COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY
COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY_NOPW
COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY
COM_USERS_EMAIL_REGISTERED_WITH_ADMIN_ACTIVATION_BODY_NOPW
In this example I am using the settings: New User Account Activation
: Self
and Send Password
: No
.
So the language string to use is: COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY_NOPW
So you can create a language override for this string with:
<div style="background-color: #ededed; border: 1px solid #ddd; padding: 12px;"><h2>Your user account needs activating</h2><p>Hello [[%1:name%]],</p><p>Thank you for registering at [[%2:sitename%]].</p><p>Your account has been created and must be activated before you can use it.<br>To activate the account select the following link or copy-paste it in your browser:<br>[[%3:url%]]</p><p>You have registered on our site using the username <strong>[[%5:username%]]</strong>.</p></div><p style="font-size: small; color: #999; text-align: center;">You are receiving this automatic email message because you have registered at [[%2:sitename%]].</p>
Or add this directly to your en-GB.override.ini
COM_USERS_EMAIL_REGISTERED_WITH_ACTIVATION_BODY_NOPW="<div style="_QQ_"background-color: #ededed; border: 1px solid #ddd; padding: 12px;"_QQ_"><h2>Your user account needs activating</h2><p>Hello [[%1:name%]],</p><p>Thank you for registering at [[%2:sitename%]].</p><p>Your account has been created and must be activated before you can use it.<br>To activate the account select the following link or copy-paste it in your browser:<br>[[%3:url%]]</p><p>You have registered on our site using the username <strong>[[%5:username%]]</strong>.</p></div><p style="_QQ_"font-size: small; color: #999; text-align: center;"_QQ_">You are receiving this automatic email message because you have registered at [[%2:sitename%]].</p>"
Status | New | ⇒ | Pending |
Labels |
Added:
?
?
|
Labels |
Category | ⇒ | Components Feature Request |
Labels |
Do you know any mail readers that are used in 2016 that don't support HTML?
No, but some are configured to block it.
BTW i think this is a nice improvement!
That would be a discussion outside the scope of this PR addition.
The admin is free to not switch on this option.
The Joomla core sendMail()
method is used by many extensions (and core) to send html emails. It does not have the ability to also send a non-html alt body.
Also, making this 'Send as HTML' a global option would be a major task and could cause issues with other components. This needs to be set on a component/extension level, IMO.
That would be a discussion outside the scope of this.
The admin is free to not switch on this option.
The Joomla core sendMail() method is used by many extensions (and core) to send html emails. It does not have the ability to also send a non-html alt body.
ok i see.
Also, making this 'Send as HTML' a global option would be a major task and could cause issues with other components. This needs to be set on a component/extension level, IMO.
yes, it would be a major task.
I would consider it bad practice to allow the sending of html only emails
without a plain text alternative and should not be encouraged. Both gmail
and outlook.com will typically mark an html only email as spam
In addition just one imperfect html tag and your guaranteed to go the spam
box
On 28 March 2016 at 14:00, Peter van Westen notifications@github.com
wrote:
That would be a discussion outside the scope of this.
The admin is free to not switch on this option.
The Joomla core sendMail() method is used by many extensions (and core)
to send html emails. It does not have the ability to also send a non-html
alt body.Also, making this 'Send as HTML' a global option would be a major task and
could cause issues with other components. This needs to be set on a
component/extension level, IMO.—
You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#9634 (comment)
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
No idea ;)
"Just because you can doesnt mean you should
Same can be said about this PR.
Leave the 'should I?' to the website administrator.
Sorry I tried.
I forgot that the only way to get something useful done for me is to concentrate on extensions. And not bother with core.
Coling this. If someone else wants to drag this uphill, be my guest.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-03-28 13:37:54 |
Closed_By | ⇒ | nonumber |
Shouldn't this be a system wide setting in com_config instead of being just for users component?
Also, IMHO, an HTML mail should also send an alternative text version, i.e.,
AltBody
(alternative body), for mail readers that don't accept HTML.More info https://github.com/PHPMailer/PHPMailer/blob/master/class.phpmailer.php#L111-L118