Install Joomla 4b6
in admin -> System -> Mail Templates -> Options -> set Mail Format = Both
Go to Joomla Global Config
Click Test Mail
An email is sent with php mail.
scroll up and see message:
Labels |
Added:
?
|
Labels |
Added:
?
|
Same error if set Mail Format to "HTML".
The reason that there no HTML template, for the test message, for com_config.test_mail
.
Same error will be for all emails without HTML template, in administrator/index.php?option=com_mails&view=templates
,
And vice versa, when Mail Format to "plaintext" but email template for "plaintext" is empty.
I guess we need some kind of fallback in Joomla\CMS\Mail\MailTemplate
, something to:
// Html fallback from plaintext
if (!$mail->htmlbody && $mail->body)
{
$mail->htmlbody = nl2br($mail->body)
}
// Plaintext fallback from HTML
if (!$mail->body && $mail->htmlbody)
{
$mail->body = strip_tags(str_replace(['<br>', '<br />'], "\n", $mail->htmlbody));
}
This will work if one of template is missing, and fail when both templates is empty (that is okay).
@Hackwar what do you think? I can try to make a PR
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-01-23 10:07:42 |
Closed_By | ⇒ | alikon |
Labels |
Removed:
?
|
@Hackwar can you have a lock at this please?