Skip to content
Browse files

Merge branch 'hotfix/3757' into develop

Forward port #3757
  • Loading branch information...
2 parents 1a7f3d6 + 9337d34 commit 968fae2cb754ced65a2bb3caf095c917a25408fb @weierophinney weierophinney committed
Showing with 15 additions and 6 deletions.
  1. +9 −0 library/Zend/Mail/Transport/Sendmail.php
  2. +6 −6 tests/ZendTest/Mail/Transport/SendmailTest.php
View
9 library/Zend/Mail/Transport/Sendmail.php
@@ -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);
}
View
12 tests/ZendTest/Mail/Transport/SendmailTest.php
@@ -83,12 +83,12 @@ public function testReceivesMailArtifactsOnUnixSystems()
$this->assertEquals('ZF DevTeam <zf-devteam@zend.com>', $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 <zf-devteam@zend.com>\r\n", $this->additional_headers);
- $this->assertContains("Cc: matthew@zend.com\r\n", $this->additional_headers);
- $this->assertContains("Bcc: \"CR-Team, ZF Project\" <zf-crteam@lists.zend.com>\r\n", $this->additional_headers);
- $this->assertContains("From: zf-devteam@zend.com,\r\n Matthew <matthew@zend.com>\r\n", $this->additional_headers);
- $this->assertContains("X-Foo-Bar: Matthew\r\n", $this->additional_headers);
- $this->assertContains("Sender: Ralph Schindler <ralph.schindler@zend.com>\r\n", $this->additional_headers);
+ $this->assertNotContains("To: ZF DevTeam <zf-devteam@zend.com>\n", $this->additional_headers);
+ $this->assertContains("Cc: matthew@zend.com\n", $this->additional_headers);
+ $this->assertContains("Bcc: \"CR-Team, ZF Project\" <zf-crteam@lists.zend.com>\n", $this->additional_headers);
+ $this->assertContains("From: zf-devteam@zend.com,\n Matthew <matthew@zend.com>\n", $this->additional_headers);
+ $this->assertContains("X-Foo-Bar: Matthew\n", $this->additional_headers);
+ $this->assertContains("Sender: Ralph Schindler <ralph.schindler@zend.com>\n", $this->additional_headers);
$this->assertEquals('-R hdrs -f ralph.schindler@zend.com', $this->additional_parameters);
}

0 comments on commit 968fae2

Please sign in to comment.
Something went wrong with that request. Please try again.