Post SMTP Mailer/Email Log - Version 2.0.10

Version Description

  • 2020-01-21
  • Fixed: HTML content type
  • Fixed: Sendgrid crash when has duplicates recipients (bypass, Sendgrid issue).
  • Fixed: Few OAuth undefined notifications
  • Fixed: Duplicate Emails - When you have notify and confirm (Ninja forms, etc..)
  • Fixed: Logs wp_error convert
Download this release

Release Info

Developer yehudah
Plugin Icon 128x128 Post SMTP Mailer/Email Log
Version 2.0.10
Comparing to
See all releases

Code changes from version 2.0.9 to 2.0.10

Postman/Phpmailer/PostsmtpMailer.php CHANGED
@@ -15,6 +15,8 @@ add_action('plugins_loaded', function() {
15
 
16
  class PostsmtpMailer extends PHPMailer {
17
 
 
 
18
  private $options;
19
 
20
  private $error;
@@ -38,11 +40,23 @@ class PostsmtpMailer extends PHPMailer {
38
  }
39
 
40
  public function hooks() {
 
41
  if ( $this->options->getTransportType() == 'smtp' ) {
42
  add_action( 'phpmailer_init', array( $this, 'phpmailer_smtp_init' ), 999 );
43
  }
44
  }
45
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**
47
  * @param PHPMailer $mail
48
  */
@@ -76,9 +90,7 @@ class PostsmtpMailer extends PHPMailer {
76
  $postmanWpMail = new PostmanWpMail();
77
  $postmanWpMail->init();
78
 
79
- $backtrace = debug_backtrace();
80
-
81
- list($to, $subject, $body, $headers, $attachments) = array_pad( $backtrace[1]['args'], 5, null );
82
 
83
  // build the message
84
  $postmanMessage = $postmanWpMail->processWpMailCall( $to, $subject, $body, $headers, $attachments );
@@ -114,8 +126,6 @@ class PostsmtpMailer extends PHPMailer {
114
 
115
  $this->mailHeader = '';
116
 
117
- do_action( 'post_smtp_on_failed', $log, $postmanMessage, $this->transcript, $transport, $exc->getMessage() );
118
-
119
  $this->setError($exc->getMessage());
120
  if ($this->exceptions) {
121
  throw $exc;
15
 
16
  class PostsmtpMailer extends PHPMailer {
17
 
18
+ private $mail_args = array();
19
+
20
  private $options;
21
 
22
  private $error;
40
  }
41
 
42
  public function hooks() {
43
+ add_filter( 'wp_mail', array( $this, 'get_mail_args' ) );
44
  if ( $this->options->getTransportType() == 'smtp' ) {
45
  add_action( 'phpmailer_init', array( $this, 'phpmailer_smtp_init' ), 999 );
46
  }
47
  }
48
 
49
+ public function get_mail_args( $atts ) {
50
+ $this->mail_args = array();
51
+ $this->mail_args[] = $atts['to'];
52
+ $this->mail_args[] = $atts['subject'];
53
+ $this->mail_args[] = $atts['message'];
54
+ $this->mail_args[] = $atts['headers'];
55
+ $this->mail_args[] = $atts['attachments'];
56
+
57
+ return $atts;
58
+ }
59
+
60
  /**
61
  * @param PHPMailer $mail
62
  */
90
  $postmanWpMail = new PostmanWpMail();
91
  $postmanWpMail->init();
92
 
93
+ list($to, $subject, $body, $headers, $attachments) = array_pad( $this->mail_args, 5, null );
 
 
94
 
95
  // build the message
96
  $postmanMessage = $postmanWpMail->processWpMailCall( $to, $subject, $body, $headers, $attachments );
126
 
127
  $this->mailHeader = '';
128
 
 
 
129
  $this->setError($exc->getMessage());
130
  if ($this->exceptions) {
131
  throw $exc;
Postman/Postman-Email-Log/PostmanEmailLogService.php CHANGED
@@ -167,8 +167,9 @@ if ( ! class_exists( 'PostmanEmailLogService' ) ) {
167
  $message = $post_id->get_error_message();
168
 
169
  printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
170
- return;
171
  });
 
 
172
  }
173
 
174
  $this->logger->debug( sprintf( 'Saved message #%s to the database', $post_id ) );
167
  $message = $post_id->get_error_message();
168
 
169
  printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
 
170
  });
171
+
172
+ return;
173
  }
174
 
175
  $this->logger->debug( sprintf( 'Saved message #%s to the database', $post_id ) );
Postman/Postman-Mail/PostmanSendGridMailEngine.php CHANGED
@@ -57,9 +57,14 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) {
57
  // now log it
58
  $sender->log( $this->logger, 'From' );
59
 
 
 
60
  // add the to recipients
61
  foreach ( ( array ) $message->getToRecipients() as $recipient ) {
62
- $emails[] = new \SendGrid\Mail\To($recipient->getEmail(), $recipient->getName() );
 
 
 
63
  }
64
 
65
  $email->addTos( $emails );
@@ -111,16 +116,22 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) {
111
  // add the cc recipients
112
  $ccEmails = array();
113
  foreach ( ( array ) $message->getCcRecipients() as $recipient ) {
114
- $recipient->log( $this->logger, 'Cc' );
115
- $ccEmails[] = new \SendGrid\Mail\Cc( $recipient->getEmail(), $recipient->getName() );
 
 
 
116
  }
117
  $email->addCcs($ccEmails);
118
 
119
  // add the bcc recipients
120
  $bccEmails = array();
121
  foreach ( ( array ) $message->getBccRecipients() as $recipient ) {
122
- $recipient->log($this->logger, 'Bcc');
123
- $bccEmails[] = new \SendGrid\Mail\Bcc( $recipient->getEmail(), $recipient->getName() );
 
 
 
124
  }
125
  $email->addBccs($bccEmails);
126
 
57
  // now log it
58
  $sender->log( $this->logger, 'From' );
59
 
60
+ $duplicates = array();
61
+
62
  // add the to recipients
63
  foreach ( ( array ) $message->getToRecipients() as $recipient ) {
64
+ if ( ! in_array( $recipient->getEmail(), $duplicates ) ) {
65
+ $emails[] = new \SendGrid\Mail\To( $recipient->getEmail(), $recipient->getName() );
66
+ $duplicates[] = $recipient->getEmail();
67
+ }
68
  }
69
 
70
  $email->addTos( $emails );
116
  // add the cc recipients
117
  $ccEmails = array();
118
  foreach ( ( array ) $message->getCcRecipients() as $recipient ) {
119
+ if ( ! in_array( $recipient->getEmail(), $duplicates ) ) {
120
+ $recipient->log($this->logger, 'Cc');
121
+ $ccEmails[] = new \SendGrid\Mail\Cc($recipient->getEmail(), $recipient->getName());
122
+ $duplicates[] = $recipient->getEmail();
123
+ }
124
  }
125
  $email->addCcs($ccEmails);
126
 
127
  // add the bcc recipients
128
  $bccEmails = array();
129
  foreach ( ( array ) $message->getBccRecipients() as $recipient ) {
130
+ if ( ! in_array( $recipient->getEmail(), $duplicates ) ) {
131
+ $recipient->log($this->logger, 'Bcc');
132
+ $bccEmails[] = new \SendGrid\Mail\Bcc($recipient->getEmail(), $recipient->getName());
133
+ $duplicates[] = $recipient->getEmail();
134
+ }
135
  }
136
  $email->addBccs($bccEmails);
137
 
Postman/PostmanOAuthToken.php CHANGED
@@ -45,10 +45,26 @@ if (! class_exists ( 'PostmanOAuthToken.php' )) {
45
  */
46
  private function load() {
47
  $a = get_option ( PostmanOAuthToken::OPTIONS_NAME );
48
- $this->setAccessToken ( $a [PostmanOAuthToken::ACCESS_TOKEN] );
49
- $this->setRefreshToken ( $a [PostmanOAuthToken::REFRESH_TOKEN] );
50
- $this->setExpiryTime ( $a [PostmanOAuthToken::EXPIRY_TIME] );
51
- $this->setVendorName ( $a [PostmanOAuthToken::VENDOR_NAME] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  }
53
 
54
  /**
45
  */
46
  private function load() {
47
  $a = get_option ( PostmanOAuthToken::OPTIONS_NAME );
48
+
49
+ if ( ! is_array( $a ) ) {
50
+ return;
51
+ }
52
+
53
+ if ( isset( $a [PostmanOAuthToken::ACCESS_TOKEN] ) ) {
54
+ $this->setAccessToken ( $a [PostmanOAuthToken::ACCESS_TOKEN] );
55
+ }
56
+
57
+ if ( isset( $a [PostmanOAuthToken::REFRESH_TOKEN] ) ) {
58
+ $this->setRefreshToken($a [PostmanOAuthToken::REFRESH_TOKEN]);
59
+ }
60
+
61
+ if ( isset( $a [PostmanOAuthToken::EXPIRY_TIME] ) ) {
62
+ $this->setExpiryTime($a [PostmanOAuthToken::EXPIRY_TIME]);
63
+ }
64
+
65
+ if ( isset( $a [PostmanOAuthToken::VENDOR_NAME] ) ) {
66
+ $this->setVendorName($a [PostmanOAuthToken::VENDOR_NAME]);
67
+ }
68
  }
69
 
70
  /**
postman-smtp.php CHANGED
@@ -6,7 +6,7 @@ if ( ! defined( 'ABSPATH' ) ) {
6
  * Plugin Name: Post SMTP
7
  * Plugin URI: https://wordpress.org/plugins/post-smtp/
8
  * 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!
9
- * Version: 2.0.9
10
  * Author: Yehuda Hassine
11
  * Text Domain: post-smtp
12
  * Author URI: https://postmansmtp.com
@@ -44,7 +44,7 @@ if ( ! defined( 'ABSPATH' ) ) {
44
  define( 'POST_SMTP_BASE', __FILE__ );
45
  define( 'POST_SMTP_PATH', __DIR__ );
46
  define( 'POST_SMTP_URL', plugins_url('', POST_SMTP_BASE ) );
47
- define( 'POST_SMTP_VER', '2.0.9' );
48
  define( 'POST_SMTP_SHOW_RELEASE_MESSAGE', true );
49
  define( 'POST_SMTP_RELEASE_MESSAGE', 'We have a new Facebook group, feel free to join.' );
50
  define( 'POST_SMTP_RELEASE_URL', 'https://www.facebook.com/groups/post.smtp' );
6
  * Plugin Name: Post SMTP
7
  * Plugin URI: https://wordpress.org/plugins/post-smtp/
8
  * 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!
9
+ * Version: 2.0.10
10
  * Author: Yehuda Hassine
11
  * Text Domain: post-smtp
12
  * Author URI: https://postmansmtp.com
44
  define( 'POST_SMTP_BASE', __FILE__ );
45
  define( 'POST_SMTP_PATH', __DIR__ );
46
  define( 'POST_SMTP_URL', plugins_url('', POST_SMTP_BASE ) );
47
+ define( 'POST_SMTP_VER', '2.0.10' );
48
  define( 'POST_SMTP_SHOW_RELEASE_MESSAGE', true );
49
  define( 'POST_SMTP_RELEASE_MESSAGE', 'We have a new Facebook group, feel free to join.' );
50
  define( 'POST_SMTP_RELEASE_URL', 'https://www.facebook.com/groups/post.smtp' );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=yehuda@m
4
  Tags: postman smtp, postman, smtp, email, mail, mailer, email log, oauth2, gmail, google apps, hotmail, yahoo, mandrill api, sendgrid api, elastic email, office365, mailgun
5
  Requires at least: 3.9
6
  Tested up to: 5.3.2
7
- Stable tag: 2.0.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -17,9 +17,6 @@ Get notified if your emails are failing inside your Chrome browser. [Download he
17
 
18
  = WordPress Mail SMTP Plugin =
19
 
20
- = Postman SMTP is back! =
21
- No need to search for another SMTP plugin anymore.
22
-
23
  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.
24
 
25
  The **Connectivity Test** and intelligent **Setup Wizard** scan your SMTP server to detect firewall blocks and eliminate configuration mistakes. The built-in **Email Log** is an invaluable resource for [diagnosing problems](https://wordpress.org/support/topic/ugly-e-mails-no-html-and-no-special-characters?replies=15) with emails. Even hosts that block the standard SMTP ports, like GoDaddy or Bluehost, can't stop your email as **Post SMTP can deliver via HTTPS** if it can't use SMTP.
@@ -87,6 +84,10 @@ SendGrid has a free SMTP plan that you can use to send up to 100 emails per day.
87
  * Reliable SMTP delivery requires credentials with an email service provider
88
  * OAuth 2.0 features require a Gmail, Hotmail or Yahoo mail OAuth 2.0 credentials
89
 
 
 
 
 
90
  = CREDITS =
91
 
92
  Post SMTP (aka Postman SMTP) plugin was originally created by Jason Hendriks.
@@ -286,6 +287,13 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a
286
 
287
  == Changelog ==
288
 
 
 
 
 
 
 
 
289
  = 2.0.9 - 2020-01-13
290
  * Fixed: Notify on error bug - crash site
291
  * Fixed: From header
4
  Tags: postman smtp, postman, smtp, email, mail, mailer, email log, oauth2, gmail, google apps, hotmail, yahoo, mandrill api, sendgrid api, elastic email, office365, mailgun
5
  Requires at least: 3.9
6
  Tested up to: 5.3.2
7
+ Stable tag: 2.0.10
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
17
 
18
  = WordPress Mail SMTP Plugin =
19
 
 
 
 
20
  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.
21
 
22
  The **Connectivity Test** and intelligent **Setup Wizard** scan your SMTP server to detect firewall blocks and eliminate configuration mistakes. The built-in **Email Log** is an invaluable resource for [diagnosing problems](https://wordpress.org/support/topic/ugly-e-mails-no-html-and-no-special-characters?replies=15) with emails. Even hosts that block the standard SMTP ports, like GoDaddy or Bluehost, can't stop your email as **Post SMTP can deliver via HTTPS** if it can't use SMTP.
84
  * Reliable SMTP delivery requires credentials with an email service provider
85
  * OAuth 2.0 features require a Gmail, Hotmail or Yahoo mail OAuth 2.0 credentials
86
 
87
+ = Looking for Google Analytics plugin? =
88
+ If you used Google Analytics Dashboard For WP and you really hate the latest updates, I have forked the original plugin here:
89
+ [https://wordpress.org/plugins/metrics-query/](https://wordpress.org/plugins/metrics-query/)
90
+
91
  = CREDITS =
92
 
93
  Post SMTP (aka Postman SMTP) plugin was originally created by Jason Hendriks.
287
 
288
  == Changelog ==
289
 
290
+ = 2.0.10 - 2020-01-21
291
+ * Fixed: HTML content type
292
+ * Fixed: Sendgrid crash when has duplicates recipients (bypass, Sendgrid issue).
293
+ * Fixed: Few OAuth undefined notifications
294
+ * Fixed: Duplicate Emails - When you have notify and confirm (Ninja forms, etc..)
295
+ * Fixed: Logs wp_error convert
296
+
297
  = 2.0.9 - 2020-01-13
298
  * Fixed: Notify on error bug - crash site
299
  * Fixed: From header