Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove port numbers from Message-id domains.

Fixes #3244
  • Loading branch information...
commit 853d866c3567da6a832f4617d07ef3796110af01 1 parent 2d46fc6
Mark Story markstory authored
2  lib/Cake/Network/Email/CakeEmail.php
View
@@ -325,7 +325,7 @@ public function __construct($config = null) {
if ($this->_appCharset !== null) {
$this->charset = $this->_appCharset;
}
- $this->_domain = env('HTTP_HOST');
+ $this->_domain = preg_replace('/\:\d+$/', '', env('HTTP_HOST'));
if (empty($this->_domain)) {
$this->_domain = php_uname('n');
}
12 lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
View
@@ -411,14 +411,18 @@ public function testDomain() {
* @return void
*/
public function testMessageIdWithDomain() {
- $result = $this->CakeEmail->getHeaders();
- $expected = '@' . (env('HTTP_HOST') ? env('HTTP_HOST') : php_uname('n')) . '>';
- $this->assertTextContains($expected, $result['Message-ID']);
-
$this->CakeEmail->domain('example.org');
$result = $this->CakeEmail->getHeaders();
$expected = '@example.org>';
$this->assertTextContains($expected, $result['Message-ID']);
+
+ $_SERVER['HTTP_HOST'] = 'example.org';
+ $result = $this->CakeEmail->getHeaders();
+ $this->assertTextContains('example.org', $result['Message-ID']);
+
+ $_SERVER['HTTP_HOST'] = 'example.org:81';
+ $result = $this->CakeEmail->getHeaders();
+ $this->assertTextNotContains(':81', $result['Message-ID']);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.