Skip to content

Commit

Permalink
Fix scenario when sending email to address that doesn't exist
Browse files Browse the repository at this point in the history
It's a valid scenario to send an email to address that is not
within the system. We use DataRow to populate something similar
to user object and send it to the notification.

Most of the internal notifications are sent this way.

If we want to check if user is active before sending an email,
we should do that only if we find the user.

remp/helpdesk#503
  • Loading branch information
rootpd committed Apr 22, 2021
1 parent fe4251e commit 8f13ca6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Hermes/SendEmailHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function handle(MessageInterface $message): bool
}

$user = $this->usersRepository->getByEmail($payload['email']);
if (!$user->active) {
if ($user && !$user->active) {
Debugger::log('Attempt to send email through REMP Mailer with inactive email address: ' . $payload['email'], ILogger::WARNING);
return false;
}
Expand Down

0 comments on commit 8f13ca6

Please sign in to comment.