Do not die if "user_history" mail template cannot be loaded

This commit is contained in:
Dmitriy Simushev 2014-12-11 13:04:25 +00:00
parent 6768fe96c2
commit 8a47afef58

View File

@ -116,10 +116,7 @@ class MailController extends AbstractController
// Load mail templates and substitute placeholders there.
$mail_template = MailTemplate::loadByName('user_history', get_current_locale());
if (!$mail_template) {
throw new \RuntimeException('Cannot load "user_history" mail template');
}
if ($mail_template) {
$this->sendMail(MailUtils::buildMessage(
$email,
MIBEW_MAILBOX,
@ -131,6 +128,12 @@ class MailController extends AbstractController
Settings::get('hosturl'),
))
));
} else {
trigger_error(
'Cannot send e-mail because "user_history" mail template cannot be loaded.',
E_USER_WARNING
);
}
$page = setup_logo($group);
$page['email'] = $email;