Skip to content

Commit

Permalink
Better support for secure delivery and auth contacts (wp-config)
Browse files Browse the repository at this point in the history
git-svn-id: https://plugins.svn.wordpress.org/post-smtp/trunk@1912939 b8457f37-d9ea-0310-8a92-e5e31aec5664
  • Loading branch information
yehudah committed Jul 22, 2018
1 parent 1058be7 commit 18dd31c
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 9 deletions.
9 changes: 8 additions & 1 deletion Postman/Postman-Mail/Zend-1.12.10/Mail/Protocol/Smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,14 @@ public function helo($host = '127.0.0.1')
stream_context_set_option($this->_socket, 'ssl', 'verify_peer_name', false);
stream_context_set_option($this->_socket, 'ssl', 'allow_self_signed', true);

if (!stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
$crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT;

if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
}

if (!stream_socket_enable_crypto($this->_socket, true, $crypto_method)) {
/**
* @see Postman_Zend_Mail_Protocol_Exception
*/
Expand Down
34 changes: 30 additions & 4 deletions Postman/PostmanOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,42 @@ public function getAuthenticationType() {
return $this->options [ PostmanOptions::AUTHENTICATION_TYPE ]; }
}
public function getEncryptionType() {
if ( isset( $this->options [ PostmanOptions::SECURITY_TYPE ] ) ) {
return $this->options [ PostmanOptions::SECURITY_TYPE ]; }
$port = $this->getPort();
switch ($port):
case 25:
return 'none';
break;
case 465:
return 'ssl';
break;
case 587:
return 'tls';
break;
case 2525:
return 'tls';
break;
default:
return isset( $this->options [ PostmanOptions::SECURITY_TYPE ] ) ? $this->options [ PostmanOptions::SECURITY_TYPE ] : 'none';
endswitch;
}
public function getUsername() {
if ( defined( POST_SMTP_AUTH_USERNAME ) ) {
return POST_SMTP_AUTH_USERNAME;
}

if ( isset( $this->options [ PostmanOptions::BASIC_AUTH_USERNAME ] ) ) {
return $this->options [ PostmanOptions::BASIC_AUTH_USERNAME ]; }
return $this->options [ PostmanOptions::BASIC_AUTH_USERNAME ];
}
}
public function getPassword() {

if ( defined( POST_SMTP_AUTH_PASSWORD ) ) {
return POST_SMTP_AUTH_PASSWORD;
}

if ( isset( $this->options [ PostmanOptions::BASIC_AUTH_PASSWORD ] ) ) {
return base64_decode( $this->options [ PostmanOptions::BASIC_AUTH_PASSWORD ] ); }
return base64_decode( $this->options [ PostmanOptions::BASIC_AUTH_PASSWORD ] );
}
}
public function getMandrillApiKey() {
if ( isset( $this->options [ PostmanOptions::MANDRILL_API_KEY ] ) ) {
Expand Down
2 changes: 1 addition & 1 deletion Postman/PostmanViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ private function displayTopNavigation() {
echo '
<div class="updated settings-error notice is-dismissible">
<p>
<strong>Version ' . $version . ' released with lockfile fix and new PHP requirement:</strong> <a target="_blank" href="https://postmansmtp.com/post-smtp-v1-8-6-lockfile-and-raise-the-php-version">Read Here</a>
<strong>Version ' . $version . ' released with better compability for secure ports:</strong> <a target="_blank" href="https://postmansmtp.com/post-smtp-1-9-0-better-support-for-secure-delivery">Read Here</a>
</p>
<button style="z-index: 100;" data-version="'. $version . '" data-security="' . wp_create_nonce('postsmtp') .'" type="button" class="notice-dismiss postman-release-message">
<span class="screen-reader-text">Dismiss this notice.</span>
Expand Down
4 changes: 2 additions & 2 deletions postman-smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin Name: Post SMTP
* Plugin URI: https://wordpress.org/plugins/post-smtp/
* Description: Email not reliable? Post SMTP is the first and only WordPress SMTP plugin to implement OAuth 2.0 for Gmail, Hotmail and Yahoo Mail. Setup is a breeze with the Configuration Wizard and integrated Port Tester. Enjoy worry-free delivery even if your password changes!
* Version: 1.8.9
* Version: 1.9.0
* Author: Jason Hendriks, Yehuda Hassine
* Text Domain: post-smtp
* Author URI: https://postmansmtp.com
Expand Down Expand Up @@ -123,5 +123,5 @@ function post_start( $startingMemory ) {
*/
function post_setupPostman() {
require_once 'Postman/Postman.php';
$kevinCostner = new Postman( __FILE__, '1.8.9' );
$kevinCostner = new Postman( __FILE__, '1.9.0' );
}
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=yehuda@m
Tags: postman smtp, postman, smtp, email, mail, mailer, email log, oauth2, gmail, google apps, hotmail, yahoo, mandrill api, sendgrid api, elastic email, office365, mailgun
Requires at least: 3.9
Tested up to: 4.9.5
Stable tag: 1.8.9
Stable tag: 1.9.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -296,6 +296,11 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a


== Changelog ==
= 1.9.0 - 2018-07-22
* Better support for secure delivery
* Support for constants auth (inside wp-config), check the detailes our [Blog](https://postmansmtp.com/post-smtp-1-9-0-better-support-for-secure-delivery)
* Automatic encryption select base on the port input - 25, 465, 587, 2525

= 1.8.9 - 2018-04-24
* Sendgrid bug

Expand Down

0 comments on commit 18dd31c

Please sign in to comment.