diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2021-02-15 10:00:35 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2021-02-15 10:00:35 +0100 |
commit | bd8b1786c56a6cbff0cc84308e96b856dff5f335 (patch) | |
tree | 1d997c5cc29cf45a468a1c70efdd365c1448b3bd /apps/settings/lib/Mailer | |
parent | 84de7a8d6356c4222f46b7b8139a4b6ac5f1aa96 (diff) | |
download | nextcloud-server-bd8b1786c56a6cbff0cc84308e96b856dff5f335.tar.gz nextcloud-server-bd8b1786c56a6cbff0cc84308e96b856dff5f335.zip |
Some psalm fixes in the settings app
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/settings/lib/Mailer')
-rw-r--r-- | apps/settings/lib/Mailer/NewUserMailHelper.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/settings/lib/Mailer/NewUserMailHelper.php b/apps/settings/lib/Mailer/NewUserMailHelper.php index f8dfeec30ff..abee7b2e045 100644 --- a/apps/settings/lib/Mailer/NewUserMailHelper.php +++ b/apps/settings/lib/Mailer/NewUserMailHelper.php @@ -172,9 +172,16 @@ class NewUserMailHelper { * @throws \Exception If mail could not be sent */ public function sendMail(IUser $user, - IEMailTemplate $emailTemplate) { + IEMailTemplate $emailTemplate): void { + + // Be sure to never try to send to an empty e-mail + $email = $user->getEMailAddress(); + if ($email === null) { + return; + } + $message = $this->mailer->createMessage(); - $message->setTo([$user->getEMailAddress() => $user->getDisplayName()]); + $message->setTo([$email => $user->getDisplayName()]); $message->setFrom([$this->fromAddress => $this->themingDefaults->getName()]); $message->useTemplate($emailTemplate); $this->mailer->send($message); |