コード例 #1
0
ファイル: configTest.php プロジェクト: photon/photon
 public function testPf()
 {
     Conf::set('mail_host', '127.0.0.1');
     $mail = Conf::pf('mail_', true);
     $this->assertArrayHasKey('host', $mail);
     $this->assertequals($mail['host'], '127.0.0.1');
     Conf::set('mail_port', 1234);
     $mail = Conf::pf('mail_', false);
     $this->assertequals(count($mail), 2);
     $this->assertArrayHasKey('mail_host', $mail);
     $this->assertArrayHasKey('mail_port', $mail);
 }
コード例 #2
0
ファイル: mail.php プロジェクト: photon/photon
 /**
  * Effectively sends the email.
  */
 function sendMail()
 {
     $body = $this->message->get();
     $hdrs = $this->message->headers($this->headers);
     $params = Conf::pf('mail_', true);
     // strip the prefix 'mail_'
     unset($params['backend']);
     $gmail = new \Mail();
     $mail = $gmail->factory(Conf::f('mail_backend', 'mail'), $params);
     if (Conf::f('send_emails', true)) {
         $ret = $mail->send($this->to_address, $hdrs, $body);
         // Mail return true on success and a PEAR_Error object on failure
         if ($ret !== true) {
             throw new Exception($ret->getMessage());
         }
     }
 }