src/Mailer/UserMailer.php
public function send($action, $args = [], $headers = [])
    {
        $results = [];

        try {
            $results = parent::send($action, $args, $headers);
        } catch (\Exception $e) {
            Log::write(LOG_CRIT, 'Emails cannot be sent: ' . $e->getMessage(), $this->_email);
        }

        return $results;
    }
public function send($action, $args = [], $headers = [])
    {
        $results = [];

        try {
            $results = parent::send($action, $args, $headers);
        } catch (\Exception $e) {
            Log::write(LOG_CRIT, 'Emails cannot be sent: ' . $e->getMessage(), $this->_email);
        }

        return $results;
    }
public function send ( $ action , $ args = [ ] , $ headers = [ ] ) { $ results = [ ] ; try { $ results = parent :: send ( $ action , $ args , $ headers ) ; } catch ( \ Exception $ e ) { Log :: write ( LOG_CRIT , 'Emails cannot be sent: ' . $ e -> getMessage ( ) , $ this -> _email ) ; } return $ results ; }
Wrap the original send to catch erros and log them.

@param string $action The name of the mailer action to trigger.
@param array $args Arguments to pass to the triggered mailer action.
@param array $headers Headers to set.
@throws \Cake\Mailer\Exception\MissingActionException
@throws \BadMethodCallException
@return array
Wrap the original send to catch erros and log them .