Skip to content

Commit

Permalink
feat. add catch to prevent internal error on register page
Browse files Browse the repository at this point in the history
  • Loading branch information
nivcoo committed Aug 28, 2021
1 parent f5109aa commit 9147cd9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/Controller/Component/UtilComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function prepareMail($to, $subject, $message)
public function sendMail()
{

App::uses('CakeEmail', 'Network/Email');
App::uses('CakeEmail', 'Network/Email', 'SocketException');
$this->Email = new CakeEmail();

if ($this->typeSend == "smtp") {
Expand All @@ -189,7 +189,13 @@ public function sendMail()
return $event->result;
}

return $this->Email->send($this->message);
$result = false;
try {
$result = $this->Email->send($this->message);
} catch (SocketException $e) {
$this->log($e->getMessage());
}
return $result;

}

Expand Down

0 comments on commit 9147cd9

Please sign in to comment.