Skip to content

Commit

Permalink
Merge branch 'hotfix/3757'
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed Feb 14, 2013
2 parents 44b7108 + 0c581ac commit 2a51b16
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
9 changes: 9 additions & 0 deletions library/Zend/Mail/Transport/Sendmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ public function send(Mail\Message $message)
$headers = $this->prepareHeaders($message);
$params = $this->prepareParameters($message);

// On *nix platforms, we need to replace \r\n with \n
// sendmail is not an SMTP server, it is a unix command - it expects LF
if (!$this->isWindowsOs()) {
$to = str_replace("\r\n", "\n", $to);
$subject = str_replace("\r\n", "\n", $subject);
$body = str_replace("\r\n", "\n", $body);
$headers = str_replace("\r\n", "\n", $headers);
}

call_user_func($this->callable, $to, $subject, $body, $headers, $params);
}

Expand Down
12 changes: 6 additions & 6 deletions tests/ZendTest/Mail/Transport/SendmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ public function testReceivesMailArtifactsOnUnixSystems()
$this->assertEquals('ZF DevTeam <[email protected]>', $this->to);
$this->assertEquals('Testing Zend\Mail\Transport\Sendmail', $this->subject);
$this->assertEquals('This is only a test.', trim($this->message));
$this->assertNotContains("To: ZF DevTeam <[email protected]>\r\n", $this->additional_headers);
$this->assertContains("Cc: [email protected]\r\n", $this->additional_headers);
$this->assertContains("Bcc: \"CR-Team, ZF Project\" <[email protected]>\r\n", $this->additional_headers);
$this->assertContains("From: [email protected],\r\n Matthew <[email protected]>\r\n", $this->additional_headers);
$this->assertContains("X-Foo-Bar: Matthew\r\n", $this->additional_headers);
$this->assertContains("Sender: Ralph Schindler <[email protected]>\r\n", $this->additional_headers);
$this->assertNotContains("To: ZF DevTeam <[email protected]>\n", $this->additional_headers);
$this->assertContains("Cc: [email protected]\n", $this->additional_headers);
$this->assertContains("Bcc: \"CR-Team, ZF Project\" <[email protected]>\n", $this->additional_headers);
$this->assertContains("From: [email protected],\n Matthew <[email protected]>\n", $this->additional_headers);
$this->assertContains("X-Foo-Bar: Matthew\n", $this->additional_headers);
$this->assertContains("Sender: Ralph Schindler <[email protected]>\n", $this->additional_headers);
$this->assertEquals('-R hdrs -f [email protected]', $this->additional_parameters);
}

Expand Down

0 comments on commit 2a51b16

Please sign in to comment.