Skip to content

Commit

Permalink
Merge pull request #35491 from owncloud/10.2.1-html-body-for-messages
Browse files Browse the repository at this point in the history
[10.2.1] Use html body for message sent via email for password change
  • Loading branch information
micbar committed Jun 12, 2019
2 parents ab5df8c + 3886b8f commit 6d85eb8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion settings/Controller/UsersController.php
Expand Up @@ -719,11 +719,14 @@ protected function sendNotificationMail($userId) {
if ($email !== '') {
$tmpl = new \OC_Template('core', 'lostpassword/notify');
$msg = $tmpl->fetchPage();
$tmplAlt = new \OC_Template('core', 'lostpassword/altnotify');
$msgAlt = $tmplAlt->fetchPage();

$message = $this->mailer->createMessage();
$message->setTo([$email => $userId]);
$message->setSubject($this->l10n->t('%s password changed successfully', [$this->defaults->getName()]));
$message->setPlainBody($msg);
$message->setPlainBody($msgAlt);
$message->setHtmlBody($msg);
$message->setFrom([$this->fromMailAddress => $this->defaults->getName()]);
$this->mailer->send($message);
}
Expand Down
3 changes: 3 additions & 0 deletions tests/Settings/Controller/UsersControllerTest.php
Expand Up @@ -3304,6 +3304,9 @@ public function testSetPasswordSendMailFailed() {
$message->expects($this->once())
->method('setPlainBody')
->willReturn($message);
$message->expects($this->once())
->method('setHtmlBody')
->willReturn($message);
$message->expects($this->once())
->method('setFrom')
->willReturn($message);
Expand Down

0 comments on commit 6d85eb8

Please sign in to comment.