Fix Lookup

This commit is contained in:
nupplaPhil 2020-02-01 22:42:36 +01:00
parent 9428466d1d
commit 206b53477e
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90

View file

@ -140,14 +140,17 @@ abstract class MailBuilder
{ {
if ((empty($this->recipientAddress)) && if ((empty($this->recipientAddress)) &&
!empty($this->recipientUid)) { !empty($this->recipientUid)) {
$user = User::getById($this->recipientUid, ['username', 'email']); $user = User::getById($this->recipientUid, ['email']);
if (!empty($user)) { if (!empty($user)) {
$this->senderName = $user['username']; $this->recipientAddress = $user['email'];
$this->senderAddress = $user['email'];
} }
} }
if (empty($this->recipientAddress)) {
throw new InternalServerErrorException('Recipient address is missing.');
}
if (empty($this->senderAddress) || empty($this->senderName)) { if (empty($this->senderAddress) || empty($this->senderName)) {
throw new InternalServerErrorException('Sender address or name is missing.'); throw new InternalServerErrorException('Sender address or name is missing.');
} }