diff options
author | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2018-11-29 11:33:11 +0000 |
---|---|---|
committer | yehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664> | 2018-11-29 11:33:11 +0000 |
commit | 4c2738e179c4d994b6b6db3c67d9d1c227a0ede1 (patch) | |
tree | 5fcee9e6188885d4d813aa0f6ae5714991843c63 | |
parent | d4f1be44c403a191b250eba13798f18a1c0daed9 (diff) | |
download | Post-SMTP-4c2738e179c4d994b6b6db3c67d9d1c227a0ede1.zip |
Diagnostic info + office 365 tls check + mailgun header issue
3 files changed, 17 insertions, 2 deletions
diff --git a/Postman/Postman-Diagnostic-Test/PostmanDiagnosticTestController.php b/Postman/Postman-Diagnostic-Test/PostmanDiagnosticTestController.php index 9f1c591..ad5fa84 100644 --- a/Postman/Postman-Diagnostic-Test/PostmanDiagnosticTestController.php +++ b/Postman/Postman-Diagnostic-Test/PostmanDiagnosticTestController.php @@ -208,8 +208,11 @@ class PostmanGetDiagnosticsViaAjax { /** */ public function getDiagnostics() { + $curl = curl_version(); $transportRegistry = PostmanTransportRegistry::getInstance(); $this->addToDiagnostics( 'HostName', PostmanUtils::getServerName() ); + $this->addToDiagnostics( 'cURL Version', $curl['version'] ); + $this->addToDiagnostics( 'OpenSSL Version', $curl['ssl_version'] ); $this->addToDiagnostics( 'OS', php_uname() ); $this->addToDiagnostics( 'PHP', PHP_OS . ' ' . PHP_VERSION . ' ' . setlocale( LC_CTYPE, 0 ) ); $this->addToDiagnostics( 'PHP Dependencies', $this->getPhpDependencies() ); diff --git a/Postman/Postman-Mail/PostmanMailgunMailEngine.php b/Postman/Postman-Mail/PostmanMailgunMailEngine.php index e874704..f098ec9 100644 --- a/Postman/Postman-Mail/PostmanMailgunMailEngine.php +++ b/Postman/Postman-Mail/PostmanMailgunMailEngine.php @@ -224,7 +224,7 @@ if ( ! class_exists( 'PostmanMailgunMailEngine' ) ) { private function addHeader( $name, $value, $deprecated = '' ) { if ( $value && ! empty( $value ) ) { - $this->mailgunMessage['h:' . $name] = $value; + $this->mailgunMessage['h:' . $name] = preg_replace('/.*:\s?/', '', $value); } } diff --git a/Postman/Postman-Mail/Zend-1.12.10/Mail/Protocol/Smtp.php b/Postman/Postman-Mail/Zend-1.12.10/Mail/Protocol/Smtp.php index be6d908..6f3c978 100644 --- a/Postman/Postman-Mail/Zend-1.12.10/Mail/Protocol/Smtp.php +++ b/Postman/Postman-Mail/Zend-1.12.10/Mail/Protocol/Smtp.php @@ -210,7 +210,19 @@ class Postman_Zend_Mail_Protocol_Smtp extends Postman_Zend_Mail_Protocol_Abstrac $crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT; - if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) { + $curl = curl_version(); + preg_match('/.*\/(\d*\.\d*\.\d*)[a-z]?/', $curl['ssl_version'], $ver_match ); + $tlsv1_2_installed = ! empty( $ver_match[1] ) ? $ver_match[1] >= '1.0.1' : true; + + if ( $this->_host == 'smtp.office365.com' && ! $tlsv1_2_installed ) { + + $error = sprintf( 'Office365 SMTP servie require TLS v1.2 and OpenSSL version 1.0.1 or greater, your current OpenSSL version is: %s. +You need to contact your web hosting support for help.', $ver_match[1] ); + + throw new Postman_Zend_Mail_Protocol_Exception( $error ); + } + + if ( defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT') ) { $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; } |