summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryehuda <yehuda@myinbox.in>2019-03-04 16:40:35 +0200
committeryehuda <yehuda@myinbox.in>2019-03-04 16:40:35 +0200
commite33f6bd6bce974ec0d9836e1589ea1facf159841 (patch)
tree5dc30b48323d8379a858326ab728c94e6455eba5
parent18c7ae6216c4705a2942b07081469c4c0f1059fd (diff)
downloadPost-SMTP-e33f6bd6bce974ec0d9836e1589ea1facf159841.zip
* Added support for our new chrome notification extension.
* few fixes
-rw-r--r--Postman/Postman-Configuration/PostmanConfigurationController.php23
-rw-r--r--Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php19
-rw-r--r--Postman/Postman-Diagnostic-Test/PostmanDiagnosticTestController.php3
-rw-r--r--Postman/Postman-Email-Log/PostmanEmailLogService.php1
-rw-r--r--Postman/Postman-Mail/PostmanMailgunMailEngine.php2
-rw-r--r--Postman/Postman-Mail/Zend-1.12.10/Mail/Protocol/Smtp.php14
-rw-r--r--Postman/PostmanInputSanitizer.php3
-rw-r--r--Postman/PostmanOptions.php14
-rw-r--r--Postman/PostmanUtils.php36
-rw-r--r--Postman/PostmanViewController.php2
-rw-r--r--Postman/notifications/PostmanMailNotify.php2
-rw-r--r--Postman/notifications/PostmanNotify.php22
-rw-r--r--postman-smtp.php4
-rw-r--r--readme.txt18
14 files changed, 126 insertions, 37 deletions
diff --git a/Postman/Postman-Configuration/PostmanConfigurationController.php b/Postman/Postman-Configuration/PostmanConfigurationController.php
index 6abb5e2..208fa0b 100644
--- a/Postman/Postman-Configuration/PostmanConfigurationController.php
+++ b/Postman/Postman-Configuration/PostmanConfigurationController.php
@@ -428,6 +428,29 @@ class PostmanConfigurationController {
</table>
</div>
+ <div id="use-chrome-extension">
+ <h2><?php _e( 'Push To Chrome Extension', Postman::TEXT_DOMAIN ); ?></h2>
+ <table class="form-table">
+ <tbody>
+ <tr>
+ <th scope="row"><?php _e( 'This is an extra notification to the selection above', Postman::TEXT_DOMAIN ); ?></th>
+ <td>
+ <input type="checkbox" id="notification_use_chrome" name="postman_options[notification_use_chrome]">
+ <a target="_blank" class="" href="https://chrome.google.com/webstore/detail/npklmbkpbknkmbohdbpikeidiaekjoch">
+ <?php _e( 'You can download the chrome extensiom here.', Postman::TEXT_DOMAIN ); ?>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <th scope="row"><?php _e( 'Your UID as you see in the extension.', Postman::TEXT_DOMAIN ); ?></th>
+ <td>
+ <input type="password" id="notification_chrome_uid" name="postman_options[notification_chrome_uid]" value="">
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
<?php
print '</fieldset>';
diff --git a/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php b/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php
index ecd7ec3..6102d10 100644
--- a/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php
+++ b/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php
@@ -213,6 +213,16 @@ class PostmanSettingsRegistry {
'slack_token_callback',
), PostmanAdminController::NOTIFICATIONS_SLACK_CRED, 'slack_credentials' );
+ add_settings_field( PostmanOptions::NOTIFICATION_USE_CHROME, _x( 'Push to chrome extension', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array(
+ $this,
+ 'notification_use_chrome_callback',
+ ), PostmanAdminController::NOTIFICATIONS_OPTIONS, PostmanAdminController::NOTIFICATIONS_SECTION );
+
+ add_settings_field( PostmanOptions::NOTIFICATION_CHROME_UID, _x( 'Chrome Extension UID', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array(
+ $this,
+ 'notification_chrome_uid_callback',
+ ), PostmanAdminController::NOTIFICATIONS_OPTIONS, PostmanAdminController::NOTIFICATIONS_SECTION );
+
}
}
@@ -415,6 +425,15 @@ class PostmanSettingsRegistry {
printf( '</select><br/><span class="postman_input_description">%s</span>', $inputDescription );
}
+ public function notification_use_chrome_callback() {
+ $value = $this->options->useChromeExtension();
+ printf( '<input type="checkbox" id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]" %3$s />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::NOTIFICATION_USE_CHROME, $value ? 'checked="checked"' : '' );
+ }
+
+ public function notification_chrome_uid_callback() {
+ printf( '<input type="password" id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]" value="%3$s" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::NOTIFICATION_CHROME_UID, $this->options->getNotificationChromeUid() );
+ }
+
public function pushover_user_callback() {
printf( '<input type="password" id="pushover_user" name="%s[%s]" value="%s" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::PUSHOVER_USER, $this->options->getPushoverUser() );
}
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-Email-Log/PostmanEmailLogService.php b/Postman/Postman-Email-Log/PostmanEmailLogService.php
index ebb2e54..103dcc1 100644
--- a/Postman/Postman-Email-Log/PostmanEmailLogService.php
+++ b/Postman/Postman-Email-Log/PostmanEmailLogService.php
@@ -182,6 +182,7 @@ if ( ! class_exists( 'PostmanEmailLogService' ) ) {
$notify = new PostmanNotify( $notifyer, $message );
$notify->send($message, $log);
+ $notify->push_to_chrome($log->statusMessage);
}
/**
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;
}
diff --git a/Postman/PostmanInputSanitizer.php b/Postman/PostmanInputSanitizer.php
index b17df30..9e1fa52 100644
--- a/Postman/PostmanInputSanitizer.php
+++ b/Postman/PostmanInputSanitizer.php
@@ -74,6 +74,9 @@ if ( ! class_exists( 'PostmanInputSanitizer' ) ) {
$this->sanitizePassword( 'Pushover Token', PostmanOptions::PUSHOVER_TOKEN, $input, $new_input, $this->options->getPushoverToken() );
$this->sanitizePassword( 'Slack Token', PostmanOptions::SLACK_TOKEN, $input, $new_input, $this->options->getSlackToken() );
+ $this->sanitizeString( 'Push Chrome Extension', PostmanOptions::NOTIFICATION_USE_CHROME, $input, $new_input );
+ $this->sanitizePassword( 'Push Chrome Extension UID', PostmanOptions::NOTIFICATION_CHROME_UID, $input, $new_input, $this->options->getNotificationChromeUid() );
+
if ( $new_input [ PostmanOptions::CLIENT_ID ] != $this->options->getClientId() || $new_input [ PostmanOptions::CLIENT_SECRET ] != $this->options->getClientSecret() || $new_input [ PostmanOptions::HOSTNAME ] != $this->options->getHostname() ) {
$this->logger->debug( 'Recognized new Client ID' );
// the user entered a new client id and we should destroy the stored auth token
diff --git a/Postman/PostmanOptions.php b/Postman/PostmanOptions.php
index 9c244bd..29ddbc6 100644
--- a/Postman/PostmanOptions.php
+++ b/Postman/PostmanOptions.php
@@ -106,6 +106,8 @@ if ( ! class_exists( 'PostmanOptions' ) ) {
const TEMPORARY_DIRECTORY = 'tmp_dir';
const DISABLE_EMAIL_VALIDAITON = 'disable_email_validation';
const NOTIFICATION_SERVICE = 'notification_service';
+ const NOTIFICATION_USE_CHROME = 'notification_use_chrome';
+ const NOTIFICATION_CHROME_UID = 'notification_chrome_uid';
const PUSHOVER_USER = 'pushover_user';
const PUSHOVER_TOKEN = 'pushover_token';
const SLACK_TOKEN = 'slack_token';
@@ -341,6 +343,18 @@ if ( ! class_exists( 'PostmanOptions' ) ) {
return base64_decode( $this->options [ PostmanOptions::SLACK_TOKEN ] );
}
}
+
+ public function useChromeExtension() {
+ if ( isset( $this->options [ PostmanOptions::NOTIFICATION_USE_CHROME ] ) ) {
+ return $this->options [ PostmanOptions::NOTIFICATION_USE_CHROME ];
+ }
+ }
+
+ public function getNotificationChromeUid() {
+ if ( isset( $this->options [ PostmanOptions::NOTIFICATION_CHROME_UID ] ) ) {
+ return base64_decode( $this->options [ PostmanOptions::NOTIFICATION_CHROME_UID ] );
+ }
+ }
public function getReplyTo() {
if ( isset( $this->options [ PostmanOptions::REPLY_TO ] ) ) {
diff --git a/Postman/PostmanUtils.php b/Postman/PostmanUtils.php
index 8d5cd46..5405b79 100644
--- a/Postman/PostmanUtils.php
+++ b/Postman/PostmanUtils.php
@@ -445,37 +445,21 @@ class PostmanUtils {
$result = 'localhost.localdomain';
if (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER)) {
- $result = $_SERVER['SERVER_NAME'];
+ $host = $_SERVER['SERVER_NAME'];
} elseif (function_exists('gethostname') and gethostname() !== false) {
- $result = gethostname();
+ $host = gethostname();
} elseif (php_uname('n') !== false) {
- $result = php_uname('n');
+ $host = php_uname('n');
}
- if ( $result !== 'localhost.localdomain' ) {
- // get the current result ip
- $ip = gethostbyname($result);
-
- // dns query failed
- if ( $ip == $result ) {
- return $result;
- }
-
- // get the current ip hostname - reverse dns
- $host = gethostbyaddr($ip);
-
- // dns query failed
- if ( $host == $ip ) {
- return $result;
- }
-
- // if hostname is not equal to the result set the ptr
- if ( $result !== $host ) {
- $result = $host;
- }
- }
+ // as final option - if ip returned or hostname without extension (not valid dns name)
+ $extension = pathinfo( $host, PATHINFO_EXTENSION );
+ if ( filter_var( $result, FILTER_VALIDATE_IP ) || empty( $extension ) ) {
+ $siteurl = get_bloginfo('url');
+ $host = parse_url($siteurl, PHP_URL_HOST);
+ }
- return $result;
+ return str_replace('www.', '', $host );
}
public static function getHost( $url ) {
diff --git a/Postman/PostmanViewController.php b/Postman/PostmanViewController.php
index 46aa39f..c0025a9 100644
--- a/Postman/PostmanViewController.php
+++ b/Postman/PostmanViewController.php
@@ -307,7 +307,7 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
echo '
<div class="updated settings-error notice is-dismissible">
<p>
- <strong>Version ' . $version . ' Mailgun Europe region support:</strong> <a target="_blank" href="https://postmansmtp.com/post-smtp-1-9-5-mailgun-europe-region-support/">Read Here</a>
+ <strong>Version ' . $version . ' We have a new Chrome Extension:</strong> <a target="_blank" href="https://postmansmtp.com/post-smtp-1-9-6-new-chrome-extension/">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>
diff --git a/Postman/notifications/PostmanMailNotify.php b/Postman/notifications/PostmanMailNotify.php
index 795afaa..0313f7f 100644
--- a/Postman/notifications/PostmanMailNotify.php
+++ b/Postman/notifications/PostmanMailNotify.php
@@ -4,7 +4,7 @@ class PostmanMailNotify implements Postman_Notify {
public function send_message($message)
{
- $to_email = get_bloginfo( 'admin_email' );
+ $to_email = apply_filters( 'post_smtp_notify_email',get_bloginfo( 'admin_email' ) );
$domain = get_bloginfo( 'url' );
mail( $to_email, "{$domain}: " . __( 'Post SMTP email error', Postman::TEXT_DOMAIN ), $message , '', "-f{$to_email}" );
diff --git a/Postman/notifications/PostmanNotify.php b/Postman/notifications/PostmanNotify.php
index 22ca56f..365d708 100644
--- a/Postman/notifications/PostmanNotify.php
+++ b/Postman/notifications/PostmanNotify.php
@@ -14,4 +14,26 @@ class PostmanNotify {
public function send( $message, $log ) {
$this->notify->send_message( $message );
}
+
+ public function push_to_chrome($message) {
+ $push_chrome = PostmanOptions::getInstance()->useChromeExtension();
+
+ if ( $push_chrome ) {
+ $uid = PostmanOptions::getInstance()->getNotificationChromeUid();
+
+ if ( empty( $uid ) ) {
+ return;
+ }
+
+ $url = 'https://postmansmtp.com/chrome/' . $uid;
+
+ $args = array(
+ 'body' => array(
+ 'message' => $message
+ )
+ );
+
+ $response = wp_remote_post( $url , $args );
+ }
+ }
} \ No newline at end of file
diff --git a/postman-smtp.php b/postman-smtp.php
index bd0f639..ba25f72 100644
--- a/postman-smtp.php
+++ b/postman-smtp.php
@@ -3,7 +3,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.9.5
+ * Version: 1.9.6
* Author: Jason Hendriks, Yehuda Hassine
* Text Domain: post-smtp
* Author URI: https://postmansmtp.com
@@ -122,5 +122,5 @@ function post_start( $startingMemory ) {
*/
function post_setupPostman() {
require_once 'Postman/Postman.php';
- $kevinCostner = new Postman( __FILE__, '1.9.5' );
+ $kevinCostner = new Postman( __FILE__, '1.9.6' );
}
diff --git a/readme.txt b/readme.txt
index 31b1e4f..72cadbd 100644
--- a/readme.txt
+++ b/readme.txt
@@ -3,8 +3,8 @@ Contributors: yehudah ,jasonhendriks
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=yehuda@myinbox.in&item_name=Donation+for+PostSMTP
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.9
-Stable tag: 1.9.5
+Tested up to: 5.0.3
+Stable tag: 1.9.6
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -12,13 +12,16 @@ Send, log and troubleshoot your Outgoing Email easily. Supports everything: SMTP
== Description ==
-= Version 1.9.5 released - Mailgun Europe region support =
-Small updates but important to read. [Read the detailes here](https://postmansmtp.com/post-smtp-1-9-5-mailgun-europe-region-support/)
+= Version 1.9.6 released - We have a new Chrome extension =
+New Chrome extension and small updates. [Read the detailes here](https://postmansmtp.com/post-smtp-1-9-6-new-chrome-extension/)
+
+= The Only SMTP plugin with chrome Notifications =
+Get notified if your emails are failing inside your Chrome browser. [Download here](https://chrome.google.com/webstore/detail/post-smtp-notifications/npklmbkpbknkmbohdbpikeidiaekjoch?hl=en-US)
= WordPress Mail SMTP Plugin =
= Postman SMTP is back! =
-Now under new maintenance, no need to search for another SMTP plugin anymore.
+No need to search for another SMTP plugin anymore.
Post SMTP is a next-generation WP Mail SMTP plugin, that assists in the delivery of email generated by your WordPress site. Post SMTP is the first and only plugin to support the [latest security standards](http://googleonlinesecurity.blogspot.ca/2014/04/new-security-measures-will-affect-older.html). With OAuth 2.0, there is **no need** to [store your email passsword](http://blog.codinghorror.com/youre-probably-storing-passwords-incorrectly/) in the WordPress database where it might be found.
@@ -285,6 +288,11 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a
== Changelog ==
+
+= 1.9.6 - 2019-01-29
+* Added support for our new chrome notification extension.
+* few fixes
+
= 1.9.5 - 2018-10-02
* Added support for Mailgun Europe region.
* Replace "buggey" mime_content_type php function