Skip to content
New issue

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

[4.0] If the Mail Template was not found in the db, return false #36489

Merged
merged 4 commits into from
Jan 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion libraries/src/Mail/MailTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
PhilETaylor marked this conversation as resolved.
Show resolved Hide resolved
{
return false;
}

/** @var Registry $params */
$params = $mail->params;
$app = Factory::getApplication();
Expand Down Expand Up @@ -370,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
*/
Expand Down