From 023ae49e912ddf151f2ad3f060a67f5591011762 Mon Sep 17 00:00:00 2001 From: "Phil E. Taylor" Date: Thu, 30 Dec 2021 00:29:42 +0000 Subject: [PATCH 1/4] If the Mail Template was not found in the db, return false --- libraries/src/Mail/MailTemplate.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/src/Mail/MailTemplate.php b/libraries/src/Mail/MailTemplate.php index d60ef39b87f0d..57e6802a62e8a 100644 --- a/libraries/src/Mail/MailTemplate.php +++ b/libraries/src/Mail/MailTemplate.php @@ -190,6 +190,12 @@ public function send() $mail = self::getTemplate($this->template_id, $this->language); + // If the Mail Template was not found in the db, we cannot send an email. + if ($mail === null) + { + return false; + } + /** @var Registry $params */ $params = $mail->params; $app = Factory::getApplication(); From 0ad2c0261761cb4611308c3116cf035dafde0aa5 Mon Sep 17 00:00:00 2001 From: "Phil E. Taylor" Date: Thu, 30 Dec 2021 19:11:52 +0000 Subject: [PATCH 2/4] Update MailTemplate.php --- libraries/src/Mail/MailTemplate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/src/Mail/MailTemplate.php b/libraries/src/Mail/MailTemplate.php index 57e6802a62e8a..c193a8794319a 100644 --- a/libraries/src/Mail/MailTemplate.php +++ b/libraries/src/Mail/MailTemplate.php @@ -28,7 +28,7 @@ class MailTemplate { /** - * Mailer object to send the actual mail. + * Mailer object to send the actual mail.. * * @var \Joomla\CMS\Mail\Mail * @since 4.0.0 From 9fa49500043e376a50235e2c6911bd2b47aae0fa Mon Sep 17 00:00:00 2001 From: "Phil E. Taylor" Date: Thu, 30 Dec 2021 19:11:59 +0000 Subject: [PATCH 3/4] Update MailTemplate.php --- libraries/src/Mail/MailTemplate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/src/Mail/MailTemplate.php b/libraries/src/Mail/MailTemplate.php index c193a8794319a..57e6802a62e8a 100644 --- a/libraries/src/Mail/MailTemplate.php +++ b/libraries/src/Mail/MailTemplate.php @@ -28,7 +28,7 @@ class MailTemplate { /** - * Mailer object to send the actual mail.. + * Mailer object to send the actual mail. * * @var \Joomla\CMS\Mail\Mail * @since 4.0.0 From 29a36a0bd93ea6a1cdb2bbd4aaa894d41481efdc Mon Sep 17 00:00:00 2001 From: "Phil E. Taylor" Date: Tue, 4 Jan 2022 17:14:15 +0000 Subject: [PATCH 4/4] docs --- libraries/src/Mail/MailTemplate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/src/Mail/MailTemplate.php b/libraries/src/Mail/MailTemplate.php index 57e6802a62e8a..994fc90f1adb8 100644 --- a/libraries/src/Mail/MailTemplate.php +++ b/libraries/src/Mail/MailTemplate.php @@ -376,7 +376,7 @@ protected function replaceTags($text, $tags) * @param string $key Template identifier * @param string $language Language code of the template * - * @return object An object with the data of the mail + * @return object|null An object with the data of the mail, or null if the template not found in the db. * * @since 4.0.0 */