diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-04-18 22:30:31 +0300 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-04-19 00:18:00 +0300 |
commit | 0a54d5a5dde832cc4353e91bd6e6af16e6e5c715 (patch) | |
tree | 84e8ec72c16d923ff2b48fcbe3c105f83f4979bc /settings | |
parent | d379ac7545d5b4d69c5419501a5084073378bc57 (diff) |
Beautify test email
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'settings')
-rw-r--r-- | settings/Controller/MailSettingsController.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/settings/Controller/MailSettingsController.php b/settings/Controller/MailSettingsController.php index f0fd7a52f0b..ed742059665 100644 --- a/settings/Controller/MailSettingsController.php +++ b/settings/Controller/MailSettingsController.php @@ -145,11 +145,19 @@ class MailSettingsController extends Controller { $email = $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'email', ''); if (!empty($email)) { try { + $displayName = $this->userSession->getUser()->getDisplayName(); + + $template = $this->mailer->createEMailTemplate(); + $template->addHeader(); + $template->addHeading($this->l10n->t('Well done, %s!', [$displayName])); + $template->addBodyText($this->l10n->t('If you received this email, the email configuration seems to be correct.')); + $template->addFooter(); + $message = $this->mailer->createMessage(); - $message->setTo([$email => $this->userSession->getUser()->getDisplayName()]); - $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.'); + $message->setTo([$email => $displayName]); + $message->setSubject($this->l10n->t('Email setting test')); + $message->setHtmlBody($template->renderHTML()); + $message->setPlainBody($template->renderText()); $errors = $this->mailer->send($message); if (!empty($errors)) { throw new \RuntimeException($this->l10n->t('Mail could not be sent. Check your mail server log')); |