From 362ab9579ed96c1ec9b24b9c0f4097081ba3516f Mon Sep 17 00:00:00 2001 From: yehudah Date: Tue, 21 Nov 2017 05:18:07 +0000 Subject: * Fixed: bug while detecting transcript error --- Postman/Postman-Email-Log/PostmanEmailLogService.php | 12 +++++++++--- postman-smtp.php | 4 ++-- readme.txt | 5 ++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Postman/Postman-Email-Log/PostmanEmailLogService.php b/Postman/Postman-Email-Log/PostmanEmailLogService.php index e5c4bfe..5f57ed8 100644 --- a/Postman/Postman-Email-Log/PostmanEmailLogService.php +++ b/Postman/Postman-Email-Log/PostmanEmailLogService.php @@ -156,12 +156,18 @@ if ( ! class_exists( 'PostmanEmailLogService' ) ) { } private function checkForLogErrors( PostmanEmailLog $log ) { + $message = __( 'You getting this message because an error detected while delivered your email.', Postman::TEXT_DOMAIN ); + $message .= "\r\n" . __( 'You are welcome to post a support issue.', Postman::TEXT_DOMAIN ); + $message .= "\r\n" . __( 'The log to paste with your support issue:', Postman::TEXT_DOMAIN ) . "\r\n"; + if ( $log->statusMessage && ! empty( $log->statusMessage ) ) { - mail( get_bloginfo( 'admin_email' ), __( 'Post SMTP email error', Postman::TEXT_DOMAIN ), $log->statusMessage ); + mail( get_bloginfo( 'admin_email' ), __( 'Post SMTP email error', Postman::TEXT_DOMAIN ), $message . $log->statusMessage ); } - if ( strpos( strtolower( $log->sessionTranscript ), 'error' ) !== false ) { - mail( get_bloginfo( 'admin_email' ), __( 'Post SMTP session transcript error', Postman::TEXT_DOMAIN ), $log->sessionTranscript ); + preg_match_all( '/(.*)From/s', $log->sessionTranscript, $matches ); + + if ( isset( $matches[1][0] ) && ! empty( $matches[1][0] ) && strpos( strtolower( $matches[1][0] ), 'error' ) !== false ) { + mail( get_bloginfo( 'admin_email' ), __( 'Post SMTP session transcript error', Postman::TEXT_DOMAIN ), $message . $log->sessionTranscript ); } } diff --git a/postman-smtp.php b/postman-smtp.php index b394b23..16bb308 100644 --- a/postman-smtp.php +++ b/postman-smtp.php @@ -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.7.9 + * Version: 1.7.10 * Author: Jason Hendriks, Yehuda Hassine * Text Domain: post-smtp * Author URI: https://postmansmtp.com @@ -71,5 +71,5 @@ function post_start( $startingMemory ) { */ function post_setupPostman() { require_once 'Postman/Postman.php'; - $kevinCostner = new Postman( __FILE__, '1.7.9' ); + $kevinCostner = new Postman( __FILE__, '1.7.10' ); } diff --git a/readme.txt b/readme.txt index 187e2f6..7236ad8 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: yehudah, jasonhendriks Tags: postman smtp, postman, smtp, email, mail, mailer, email log, oauth2, gmail, google apps, hotmail, yahoo, mandrill api, sendgrid api, elastic email Requires at least: 3.9 Tested up to: 4.9 -Stable tag: 1.7.9 +Stable tag: 1.7.10 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -283,6 +283,9 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a == Changelog == += 1.7.10 - 2017-11-21 == +* Fixed: bug while detecting transcript error + = 1.7.9 - 2017-11-20 * Fixed: misspled false * Fixed: feedback form -- cgit v1.2.3