Skip to content

Commit

Permalink
log email when failed to send
Browse files Browse the repository at this point in the history
  • Loading branch information
agungsugiarto committed Jun 3, 2021
1 parent be475c3 commit 60a158e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
13 changes: 10 additions & 3 deletions src/Notifications/ResetPasswordNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,22 @@ public function __construct(string $email, string $token)
*/
public function send()
{
return $this->service
$this->service
->setTo($this->email)
->setSubject("Reset Password Notification")
->setMessage(view('Fluent\Auth\Views\Email\reset_email', [
'token' => $this->token,
'email' => $this->email,
'expire' => config('Auth')->passwords[config('Auth')->defaults['password']]['expire'],
]))
->setMailType('html')
->send();
->setMailType('html');

if (! $this->service->send()) {
log_message('error', $this->service->printDebugger());

return false;
}

return true;
}
}
15 changes: 11 additions & 4 deletions src/Notifications/VerificationNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,22 @@ public function __construct(string $email)
*/
public function send()
{
return $this->service
$this->service
->setTo($this->email)
->setSubject('Verify Email Notification')
->setMessage(view('Fluent\Auth\Views\Email\verify_email', [
'hash' => sha1($this->email),
'expire' => Time::now()->addMinutes(config('Auth')->passwords[config('Auth')->defaults['password']]['expire'])->getTimestamp(),
'signature' => hash_hmac('sha256', $this->email, config('Encryption')->key),
]))
->setMailType('html')
->send();
->setMailType('html');

if (! $this->service->send()) {
log_message('error', $this->service->printDebugger());

return false;
}

return true;
}
}
}

0 comments on commit 60a158e

Please sign in to comment.