We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try to send mail using a mail template which does not exist.
$mailer = new MailTemplate('com_bftest.invalidtemplateid', $language); $mailer->addRecipient($templateData['emailto'], $templateData['emailtoname']); $mailer->setReplyTo($templateData['replytoemail'], $templateData['replytoname']); $mailer->addTemplateData($templateData); $sent = $mailer->send();
Sensible error message saying template does not exist
Load of PHP notices and a 'Message body empty' warning.
Be better to add a getInstance() static method to MailTemplate which would allow this
$mailer = MailTemplate::getInstance('com_bftest.invalidtemplateid', $language); if (empty($mailer)) { ... take some action ... } $mailer->addRecipient($templateData['emailto'], $templateData['emailtoname']); $mailer->setReplyTo($templateData['replytoemail'], $templateData['replytoname']); $mailer->addTemplateData($templateData); $sent = $mailer->send();
Can do this as a workaround - downside MailTemplate::getTemplate() gets called twice.
$test = MailTemplate::getTemplate($templateId, $language); if (empty($mail)) { ... take some action ... } $mailer = new MailTemplate('com_bftest.invalidtemplateid', $language); $mailer->addRecipient($templateData['emailto'], $templateData['emailtoname']); $mailer->setReplyTo($templateData['replytoemail'], $templateData['replytoname']); $mailer->addTemplateData($templateData); $sent = $mailer->send();
The text was updated successfully, but these errors were encountered:
Closing as having a pull request. Please test #36489 . Thanks in adcance.
Sorry, something went wrong.
No branches or pull requests
Steps to reproduce the issue
Try to send mail using a mail template which does not exist.
Expected result
Sensible error message saying template does not exist
Actual result
Load of PHP notices and a 'Message body empty' warning.
System information (as much as possible)
Additional comments
Be better to add a getInstance() static method to MailTemplate which would allow this
Can do this as a workaround - downside MailTemplate::getTemplate() gets called twice.
The text was updated successfully, but these errors were encountered: