From 53b2035def91dc0fe6d8f68e4a34aca2acc79ec8 Mon Sep 17 00:00:00 2001 From: yehudah Date: Sat, 20 Jun 2020 21:39:39 +0000 Subject: Email log improvements: Solution column, filter. Some text clarify. --- .../Core/Notifications/PostmanPushoverNotify.php | 4 +- Postman/Extensions/Core/StatusSolution.php | 56 ++++++++++++++++++++++ .../Extensions/License/PostmanLicenseManager.php | 6 +-- .../PostmanRegisterConfigurationSettings.php | 2 +- .../PostmanConnectivityTestController.php | 2 +- .../PostmanEmailLogController.php | 29 +++++------ .../Postman-Email-Log/PostmanEmailLogService.php | 4 ++ Postman/Postman-Email-Log/PostmanEmailLogView.php | 31 ++++++++---- .../Postman-Mail/PostmanSmtpModuleTransport.php | 2 +- .../PostmanSendTestEmailController.php | 3 +- Postman/Postman.php | 12 +++-- Postman/PostmanLogFields.php | 12 +++++ 12 files changed, 124 insertions(+), 39 deletions(-) create mode 100644 Postman/Extensions/Core/StatusSolution.php (limited to 'Postman') diff --git a/Postman/Extensions/Core/Notifications/PostmanPushoverNotify.php b/Postman/Extensions/Core/Notifications/PostmanPushoverNotify.php index 14ef7d2..c1f2661 100644 --- a/Postman/Extensions/Core/Notifications/PostmanPushoverNotify.php +++ b/Postman/Extensions/Core/Notifications/PostmanPushoverNotify.php @@ -6,7 +6,7 @@ class PostmanPushoverNotify implements Postman_Notify { public function send_message($message) { - $options = PostmanOptions::getInstance(); + $options = PostmanNotifyOptions::getInstance(); $api_url = "https://api.pushover.net/1/messages.json"; $app_token = $options->getPushoverToken(); @@ -31,4 +31,4 @@ class PostmanPushoverNotify implements Postman_Notify { error_log( __CLASS__ . ': ' . print_r( $body, true ) ); } } -} \ No newline at end of file +} diff --git a/Postman/Extensions/Core/StatusSolution.php b/Postman/Extensions/Core/StatusSolution.php new file mode 100644 index 0000000..67ac768 --- /dev/null +++ b/Postman/Extensions/Core/StatusSolution.php @@ -0,0 +1,56 @@ +status = addslashes( $status ); + $possible_solution = []; + + if ( $this->strExists('timed out') ) { + $possible_solution[] = $this->make_clickable('https://postmansmtp.com/office365-smtp-connection-timed-out/'); + } elseif ( $this->strExists('timeout') || $this->strExists('open socket' ) ) { + $possible_solution[] = 'Your hosting is blocking the connection, contact their support'; + } elseif ( $this->strExists( 'DATA NOT ACCEPTED' ) || $this->strExists('Exception:SendAsDeniedException' ) ) { + $possible_solution[] = $this->make_clickable('https://postmansmtp.com/storedrv-submission-exceptionsendasdeniedexception-mapiexceptionsendasdenied/'); + } elseif ( $this->strExists( 'Incorrect authentication data') ) { + $possible_solution[] = $this->make_clickable( 'https://postmansmtp.com/incorrect-authentication-data/' ); + } elseif ( $this->strExists( 'Unrecognized authentication type' ) ) { + $possible_solution[] = 'Change "Authentication" type on plugin settings to "Login"'; + } elseif ( $this->strExists( 'Error executing "SendRawEmail"' ) ) { + $possible_solution[] = 'Amazon SES - account permission error (review account configuration)'; + } elseif ( $this->strExists( 'Please log in via your web browser and then try again' ) ) { + $possible_solution[] = $this->make_clickable( 'https://postmansmtp.com/gmail-gsuite-please-log-in-via-your-web-browser-and-then-try-again/' ); + } elseif ( $this->strExists( 'Application-specific password required' ) ) { + $possible_solution[] = 'Two factor authentication is enabled, replace your password with app password.'; + $possible_solution[] = $this->make_clickable( 'https://support.google.com/mail/?p=InvalidSecondFactor' ); + } elseif ( $this->strExists( 'Username and Password not accepted' ) || $this->strExists( 'Authentication unsuccessful' ) ) { + $possible_solution[] = 'Check you credentials, wrong email or password.'; + } else { + $possible_solution[] = 'Not found, check status column for more info.'; + } + + return ! empty( $possible_solution ) ? implode( '
', $possible_solution ) : ''; + } + + private function make_clickable($url) { + return '' . esc_html( 'Read here' ) . ''; + } + + private function strExists( $value ) { + return strpos( strtolower( $this->status ), strtolower( addslashes( $value ) ) ) !== false; + } + +} + +new StatusSolution(); \ No newline at end of file diff --git a/Postman/Extensions/License/PostmanLicenseManager.php b/Postman/Extensions/License/PostmanLicenseManager.php index 280b564..cb10852 100644 --- a/Postman/Extensions/License/PostmanLicenseManager.php +++ b/Postman/Extensions/License/PostmanLicenseManager.php @@ -68,11 +68,9 @@ class PostmanLicenseManager { $this->extensions[$slug]['plugin_dir_and_filename'] = $plugin_dir_and_filename; $this->extensions[$slug]['license_manager'] = new PostmanLicenseHandler( $plugin_path, $plugin_data['Name'], - $plugin_data['Version'], $plugin_data['Author'] + $plugin_data['Version'], $plugin_data['Author'], null, self::ENDPOINT ); if ( $this->extensions[$slug]['license_manager']->is_licensed() ) { - include_once $plugin_path; - $this->extensions[$slug]['instance'] = new $class; } } @@ -99,4 +97,4 @@ class PostmanLicenseManager { public function get_extensions() { return $this->extensions; } -} \ No newline at end of file +} diff --git a/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php b/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php index 9c0170b..0910cc9 100644 --- a/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php +++ b/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php @@ -271,7 +271,7 @@ class PostmanSettingsRegistry { } print ''; ?> -

PHPMailer only if you see wp_mail conflict message, conflicts when another plugin is activated, and sometimes spam issues.', 'post-smtp' ); ?>

+

PHPMailer only if you see wp_mail conflict message, conflicts when another plugin is activated, and sometimes your mail marked as spam.', 'post-smtp' ); ?>

'; /* Translators: Where %s is the name of the service providing Internet connectivity test */ - printf( '', sprintf( __( 'According to %s', 'post-smtp' ), 'portquiz.net' ) ); + printf( '', sprintf( __( 'According to %s', 'post-smtp' ), 'portquiz.net' ) ); printf( '', plugins_url( 'post-smtp/style/ajax-loader.gif' ) ); print '