summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-02-19 21:55:02 +0100
committerLukas Reschke <lukas@owncloud.com>2015-03-16 12:47:06 +0100
commite32f1582c76252ae80802c0851a9583504131dff (patch)
tree247976a9bd3dd9f9549b205ba58a0c0c2e721cc9 /settings
parentdfd70337d6db5e6e15f6763d5e8762f189e9fd71 (diff)
downloadnextcloud-server-e32f1582c76252ae80802c0851a9583504131dff.tar.gz
nextcloud-server-e32f1582c76252ae80802c0851a9583504131dff.zip
Show more detailed error message
Diffstat (limited to 'settings')
-rw-r--r--settings/controller/mailsettingscontroller.php24
1 files changed, 12 insertions, 12 deletions
diff --git a/settings/controller/mailsettingscontroller.php b/settings/controller/mailsettingscontroller.php
index 43715b82237..53365cf253b 100644
--- a/settings/controller/mailsettingscontroller.php
+++ b/settings/controller/mailsettingscontroller.php
@@ -135,19 +135,19 @@ class MailSettingsController extends Controller {
$email = $this->config->getUserValue($this->userSession->getUser()->getUID(), $this->appName, 'email', '');
if (!empty($email)) {
try {
- $this->mail->send($email, $this->userSession->getUser()->getDisplayName(),
- $this->l10n->t('test email settings'),
- $this->l10n->t('If you received this email, the settings seem to be correct.'),
- $this->defaultMailAddress,
- $this->defaults->getName()
- );
+ $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.');
+ $this->mailer->send($message);
} catch (\Exception $e) {
- return array('data' =>
- array('message' =>
- (string) $this->l10n->t('A problem occurred while sending the email. Please revise your settings.'),
- ),
- 'status' => 'error'
- );
+ return [
+ 'data' => [
+ 'message' => (string) $this->l10n->t('A problem occurred while sending the email. Please revise your settings. (Error: %s)', [$e->getMessage()]),
+ ],
+ 'status' => 'error',
+ ];
}
return array('data' =>