Exemplo n.º 1
0
 public function testSendEscapedEmail()
 {
     $headers = new Headers();
     $headers->addHeaderLine('Date', 'Sun, 10 Jun 2012 20:07:24 +0200');
     $message = new Message();
     $message->setHeaders($headers)->setSender('*****@*****.**', 'Ralph Schindler')->setBody("This is a test\n.")->addTo('*****@*****.**', 'ZF DevTeam');
     $expectedMessage = "EHLO localhost\r\n" . "MAIL FROM:<*****@*****.**>\r\n" . "DATA\r\n" . "Date: Sun, 10 Jun 2012 20:07:24 +0200\r\n" . "Sender: Ralph Schindler <*****@*****.**>\r\n" . "To: ZF DevTeam <*****@*****.**>\r\n" . "\r\n" . "This is a test\r\n" . "..\r\n" . ".\r\n";
     $this->transport->send($message);
     $this->assertEquals($expectedMessage, $this->connection->getLog());
 }
Exemplo n.º 2
0
 public function testSendMinimalMail()
 {
     $headers = new Headers();
     $headers->addHeaderLine('Date', 'Sun, 10 Jun 2012 20:07:24 +0200');
     $message = new Message();
     $message->setHeaders($headers)->setSender('*****@*****.**', 'Ralph Schindler')->setBody('testSendMailWithoutMinimalHeaders')->addTo('*****@*****.**', 'ZF DevTeam');
     $expectedMessage = "RSET\r\n" . "MAIL FROM:<*****@*****.**>\r\n" . "DATA\r\n" . "Date: Sun, 10 Jun 2012 20:07:24 +0200\r\n" . "Sender: Ralph Schindler <*****@*****.**>\r\n" . "To: ZF DevTeam <*****@*****.**>\r\n" . "\r\n" . "testSendMailWithoutMinimalHeaders\r\n" . ".\r\n";
     $this->transport->send($message);
     $this->assertEquals($expectedMessage, $this->connection->getLog());
 }
Exemplo n.º 3
0
 public function testReceivesMailArtifacts()
 {
     $message = $this->getMessage();
     $this->transport->send($message);
     $this->assertEquals('*****@*****.**', $this->connection->getMail());
     $expectedRecipients = array('*****@*****.**', '*****@*****.**', '*****@*****.**');
     $this->assertEquals($expectedRecipients, $this->connection->getRecipients());
     $data = $this->connection->getLog();
     $this->assertContains('To: ZF DevTeam <*****@*****.**>', $data);
     $this->assertContains('Subject: Testing Zend\\Mail\\Transport\\Sendmail', $data);
     $this->assertContains("Cc: matthew@zend.com\r\n", $data);
     $this->assertNotContains("Bcc: \"CR-Team, ZF Project\" <*****@*****.**>\r\n", $data);
     $this->assertNotContains("*****@*****.**", $data);
     $this->assertContains("From: zf-devteam@zend.com,\r\n Matthew <*****@*****.**>\r\n", $data);
     $this->assertContains("X-Foo-Bar: Matthew\r\n", $data);
     $this->assertContains("Sender: Ralph Schindler <*****@*****.**>\r\n", $data);
     $this->assertContains("\r\n\r\nThis is only a test.", $data, $data);
 }