Beispiel #1
0
 /**
  * @inheritDoc
  */
 public function send($action, $args = [], $headers = [])
 {
     $this->fixateLocale();
     $result = parent::send($action, $args, $headers);
     $this->restoreLocale();
     return $result;
 }
Beispiel #2
0
 /**
  * Constructor
  * @param \Cake\Mailer\Email|null $email Email instance
  * @uses Cake\Mailer\Mailer::__construct()
  */
 public function __construct(\Cake\Mailer\Email $email = null)
 {
     parent::__construct($email);
     $this->_email->profile('default')->helpers('MeTools.Html')->set('ipAddress', getClientIp())->from(config('email.webmaster'), config('main.title'))->sender(config('email.webmaster'), config('main.title'))->emailFormat('html');
 }
Beispiel #3
0
 /**
  * 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
  */
 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;
 }
Beispiel #4
0
 public function reset()
 {
     $this->template = $this->viewBuilder()->template();
     return parent::reset();
 }