From 206b53477ec4d0538be5ce92619f8ec920019848 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Sat, 1 Feb 2020 22:42:36 +0100 Subject: [PATCH] Fix Lookup --- src/Util/EMailer/MailBuilder.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Util/EMailer/MailBuilder.php b/src/Util/EMailer/MailBuilder.php index fe801bd562..c2c2f75dc5 100644 --- a/src/Util/EMailer/MailBuilder.php +++ b/src/Util/EMailer/MailBuilder.php @@ -140,14 +140,17 @@ abstract class MailBuilder { if ((empty($this->recipientAddress)) && !empty($this->recipientUid)) { - $user = User::getById($this->recipientUid, ['username', 'email']); + $user = User::getById($this->recipientUid, ['email']); if (!empty($user)) { - $this->senderName = $user['username']; - $this->senderAddress = $user['email']; + $this->recipientAddress = $user['email']; } } + if (empty($this->recipientAddress)) { + throw new InternalServerErrorException('Recipient address is missing.'); + } + if (empty($this->senderAddress) || empty($this->senderName)) { throw new InternalServerErrorException('Sender address or name is missing.'); } -- 2.39.5