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); }
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); }
/** * set server and port * @param string $host server * @param int $port port * @param string $secure ssl tls * @return $this */ public function setServer($host, $port, $secure = null) { $this->smtp->setServer($host, $port, $secure); return $this; }