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);
 }
 /**
  * @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);
 }
 public function sendEmailBySmtp($from, $to, $subject, $body)
 {
     $this->_createSmtpClient();
     $message = new Message();
     $message->setFrom($from, $from);
     $message->setTo($to, $to);
     $message->setSubject($subject);
     $message->setBody($body);
     $this->client->send($message);
 }
 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");
 }
Exemple #5
0
 /**
  * set mail from
  * @param string $name
  * @param string $email
  * @return $this
  */
 public function setFrom($name, $email)
 {
     $this->message->setFrom($name, $email);
     return $this;
 }