Example #1
0
 /**
  * Effectively sends the email.
  */
 function sendMail()
 {
     if ($this->backend === null) {
         $params = Pluf::pf('mail_', true);
         // strip the prefix 'mail_'
         unset($params['backend']);
         $gmail = new Mail();
         if (Pluf::f('mail_backend') == 'smtp') {
             $params['persist'] = true;
         }
         $this->backend = $gmail->factory(Pluf::f('mail_backend', 'mail'), $params);
     }
     $body = $this->message->get();
     $hdrs = $this->message->headers($this->headers);
     if (Pluf::f('send_emails', true)) {
         $this->backend->send($this->headers['To'], $hdrs, $body);
     }
     $this->message = new Mail_mime($this->crlf);
     $this->message->_build_params['html_charset'] = $this->encoding;
     $this->message->_build_params['text_charset'] = $this->encoding;
     $this->message->_build_params['head_charset'] = $this->encoding;
     $this->headers = array('From' => $this->from);
 }
Example #2
0
 /**
  * Effectively sends the email.
  */
 function sendMail()
 {
     $body = $this->message->get();
     $hdrs = $this->message->headers($this->headers);
     $params = Pluf::pf('mail_', true);
     // strip the prefix 'mail_'
     unset($params['backend']);
     $gmail = new Mail();
     $mail = $gmail->factory(Pluf::f('mail_backend', 'mail'), $params);
     if (Pluf::f('send_emails', true)) {
         $mail->send($this->to_address, $hdrs, $body);
     }
     if (defined('IN_UNIT_TESTS')) {
         $GLOBALS['_PX_UNIT_TESTS']['emails'][] = array($this->to_address, $hdrs, $body);
     }
 }