summaryrefslogtreecommitdiff
path: root/Postman/Postman-Email-Log
diff options
context:
space:
mode:
authoryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2017-11-21 05:18:07 +0000
committeryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2017-11-21 05:18:07 +0000
commit362ab9579ed96c1ec9b24b9c0f4097081ba3516f (patch)
tree5ed3402d13b220eb9ab941eadeafdbf467f1b710 /Postman/Postman-Email-Log
parentf89e1bb73c82ba155b03043200c4042dc3345030 (diff)
downloadPost-SMTP-362ab9579ed96c1ec9b24b9c0f4097081ba3516f.zip
* Fixed: bug while detecting transcript error
Diffstat (limited to 'Postman/Postman-Email-Log')
-rw-r--r--Postman/Postman-Email-Log/PostmanEmailLogService.php12
1 files changed, 9 insertions, 3 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 );
}
}