Fail when the test mail could not be sent

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-03-17 13:45:25 +01:00
parent a5c8016c8b
commit 4caae91b83
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
1 changed files with 4 additions and 1 deletions

View File

@ -153,7 +153,10 @@ class MailSettingsController extends Controller {
$message->setFrom([$this->defaultMailAddress]);
$message->setSubject($this->l10n->t('test email settings'));
$message->setPlainBody('If you received this email, the settings seem to be correct.');
$this->mailer->send($message);
$errors = $this->mailer->send($message);
if (!empty($errors)) {
throw new \RuntimeException($this->l10n->t('Mail could not be sent. Check your mail server log'));
}
} catch (\Exception $e) {
return [
'data' => [