示例#1
0
 private function _createSmtpClient()
 {
     if (is_null($this->client)) {
         $this->client = new SMTP();
         $this->client->setServer($this->config['host'], $this->config['port']);
     }
 }
 /**
  * @expectedException \Tx\Mailer\Exceptions\SMTPException
  */
 public function testConnectSMTPException()
 {
     $this->smtp->setServer("localhost", "99999", null)->setAuth('none', 'none');
     $message = new Message();
     $message->setFrom('You', '*****@*****.**')->setTo('Them', '*****@*****.**')->setSubject('This is a test')->setBody('This is a test part two');
     $this->smtp->send($message);
 }
示例#3
0
 public function testSMTP()
 {
     $this->smtp->setServer(self::SERVER, self::PORT)->setAuth(self::USER, self::PASS);
     // email, password
     $this->message->setFrom('Tom', '*****@*****.**')->setFakeFrom('heelo', '*****@*****.**')->addTo('Cloud', '*****@*****.**')->setSubject('Test SMTP ' . time())->setBody('<h1>for test</h1>')->addAttachment('host', __FILE__);
     $status = $this->smtp->send($this->message);
     $this->assertTrue($status);
     usleep(self::DELAY);
 }
 public function testSendEmailBySmtp()
 {
     $this->client->shouldReceive('send')->with(m::on(function ($value) {
         $message = new Message();
         $message->setFrom("*****@*****.**", "*****@*****.**");
         $message->setTo("*****@*****.**", "*****@*****.**");
         $message->setSubject("Foo");
         $message->setBody("Bar");
         return $message == $value;
     }));
     $this->module->sendEmailBySmtp("*****@*****.**", "*****@*****.**", "Foo", "Bar");
 }
示例#5
0
 /**
  *  Send the message...
  * @return boolean
  */
 public function send()
 {
     return $this->smtp->send($this->message);
 }