summaryrefslogtreecommitdiffstats
path: root/system/libraries/Email.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-03-23 14:24:06 +0100
committerFlorian Pritz <bluewind@xinu.at>2018-03-23 14:24:06 +0100
commitd0f6e6ab2e1dbb968a0ef0021f0b9cd64313863b (patch)
treea8cd95ddf85c9a852f522eae14dda0de4151d38b /system/libraries/Email.php
parent006cf0764295d37daa597f4ea9cf31abb75d1b68 (diff)
parent71e647782764184e3aab4faffe6d99176758979f (diff)
Merge tag 'ci-upstream/3.1.8' into dev
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'system/libraries/Email.php')
-rw-r--r--system/libraries/Email.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 6a8bda70e..a53e7e72a 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -1035,7 +1035,7 @@ class CI_Email {
if (function_exists('idn_to_ascii') && strpos($email, '@'))
{
list($account, $domain) = explode('@', $email, 2);
- $domain = is_php('5.4')
+ $domain = defined('INTL_IDNA_VARIANT_UTS46')
? idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46)
: idn_to_ascii($domain);
$email = $account.'@'.$domain;
@@ -1856,7 +1856,7 @@ class CI_Email {
if (function_exists('idn_to_ascii') && strpos($email, '@'))
{
list($account, $domain) = explode('@', $email, 2);
- $domain = is_php('5.4')
+ $domain = defined('INTL_IDNA_VARIANT_UTS46')
? idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46)
: idn_to_ascii($domain);
$email = $account.'@'.$domain;
@@ -2074,7 +2074,19 @@ class CI_Email {
$this->_send_command('hello');
$this->_send_command('starttls');
- $crypto = stream_socket_enable_crypto($this->_smtp_connect, TRUE, STREAM_CRYPTO_METHOD_TLS_CLIENT);
+ /**
+ * STREAM_CRYPTO_METHOD_TLS_CLIENT is quite the mess ...
+ *
+ * - On PHP <5.6 it doesn't even mean TLS, but SSL 2.0, and there's no option to use actual TLS
+ * - On PHP 5.6.0-5.6.6, >=7.2 it means negotiation with any of TLS 1.0, 1.1, 1.2
+ * - On PHP 5.6.7-7.1.* it means only TLS 1.0
+ *
+ * We want the negotiation, so we'll force it below ...
+ */
+ $method = is_php('5.6')
+ ? STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
+ : STREAM_CRYPTO_METHOD_TLS_CLIENT;
+ $crypto = stream_socket_enable_crypto($this->_smtp_connect, TRUE, $method);
if ($crypto !== TRUE)
{