diff options
author | Ahmad Anbar <aanbar@gmail.com> | 2015-02-08 17:29:52 +0100 |
---|---|---|
committer | Ahmad Anbar <aanbar@gmail.com> | 2015-02-08 17:29:52 +0100 |
commit | ed520408514fff6486788e1543589418d24d885e (patch) | |
tree | 07fd3194e9c6baf7aeaa9ccdd164e3fec4494922 /system/libraries/Email.php | |
parent | e5454f9b28f123a5549971f580255a065b2f8cc2 (diff) | |
parent | 266c93cc505ae9a8cafb41f9d9432b056de492e0 (diff) |
Merge remote-tracking branch 'upstream/develop' into develop
Diffstat (limited to 'system/libraries/Email.php')
-rw-r--r-- | system/libraries/Email.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 4e0e0cd9f..45c5c09b9 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -2172,11 +2172,22 @@ 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 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'] : 'localhost.localdomain'; + if (isset($_SERVER['SERVER_NAME'])) + { + return $_SERVER['SERVER_NAME']; + } + + return isset($_SERVER['SERVER_ADDR']) ? '['.$_SERVER['SERVER_ADDR'].']' : '[127.0.0.1]'; } // -------------------------------------------------------------------- |