From 3245af4adc8a271e9bb2eeef991dff7e879a427f Mon Sep 17 00:00:00 2001 From: James Wade Date: Fri, 6 Feb 2015 11:48:51 +0000 Subject: Fix HELO localhost.localdomain violates RFC standards --- system/libraries/Email.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'system/libraries/Email.php') diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 4e0e0cd9f..43dbe28b4 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -2171,12 +2171,16 @@ class CI_Email { /** * Get Hostname - * + * + * There are only two legal types of hostname either a fully qualified domain + * name (eg: "mail.example.com") or an "IP literal" (eg: "[1.2.3.4]"). + * + * @link http://cbl.abuseat.org/namingproblems.html * @return string */ protected function _get_hostname() { - return isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost.localdomain'; + return isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '[' . $_SERVER['SERVER_ADDR'] . ']'; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 396eb89d1624f0bad6bc41ee477f40e824be41d9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 6 Feb 2015 14:50:10 +0200 Subject: Polish changes following PR #3573 --- system/libraries/Email.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'system/libraries/Email.php') diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 43dbe28b4..45c5c09b9 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -2171,16 +2171,23 @@ class CI_Email { /** * Get Hostname - * - * There are only two legal types of hostname either a fully qualified domain - * name (eg: "mail.example.com") or an "IP literal" (eg: "[1.2.3.4]"). - * + * + * There are only two legal types of hostname - either a fully + * qualified domain name (eg: "mail.example.com") or an IP literal + * (eg: "[1.2.3.4]"). + * + * @link https://tools.ietf.org/html/rfc5321#section-2.3.5 * @link http://cbl.abuseat.org/namingproblems.html * @return string */ protected function _get_hostname() { - return isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '[' . $_SERVER['SERVER_ADDR'] . ']'; + if (isset($_SERVER['SERVER_NAME'])) + { + return $_SERVER['SERVER_NAME']; + } + + return isset($_SERVER['SERVER_ADDR']) ? '['.$_SERVER['SERVER_ADDR'].']' : '[127.0.0.1]'; } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b