Skip to content

Commit

Permalink
Adding test for escaping of emails that have lines starting with a pe…
Browse files Browse the repository at this point in the history
…riod character.
  • Loading branch information
Elliot Wiltshire committed Nov 5, 2013
1 parent 052e76f commit 0818058
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/ZendTest/Mail/Protocol/SmtpTest.php
Original file line number Diff line number Diff line change
@@ -57,6 +57,34 @@ public function testSendMinimalMail()
$this->assertEquals($expectedMessage, $this->connection->getLog());
}

public function testSendEscapedEmail()
{
$headers = new Headers();
$headers->addHeaderLine('Date', 'Sun, 10 Jun 2012 20:07:24 +0200');
$message = new Message();
$message
->setHeaders($headers)
->setSender('[email protected]', 'Ralph Schindler')
->setBody("This is a test\n.")
->addTo('[email protected]', 'ZF DevTeam')
;
$expectedMessage = "EHLO localhost\r\n"
. "MAIL FROM:<[email protected]>\r\n"
. "DATA\r\n"
. "Date: Sun, 10 Jun 2012 20:07:24 +0200\r\n"
. "Sender: Ralph Schindler <[email protected]>\r\n"
. "To: ZF DevTeam <[email protected]>\r\n"
. "\r\n"
. "This is a test\r\n"
. "..\r\n"
. ".\r\n";

$this->transport->send($message);

$this->assertEquals($expectedMessage, $this->connection->getLog());

}

public function testDisconnectCallsQuit()
{
$this->connection->disconnect();

0 comments on commit 0818058

Please sign in to comment.