Post SMTP Mailer/Email Log - Version 1.8.9

Version Description

  • 2018-04-24
  • Sendgrid bug
Download this release

Release Info

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

Code changes from version 1.8.8 to 1.8.9

Postman/Postman-Mail/PostmanSendGridMailEngine.php CHANGED
@@ -188,9 +188,12 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) {
188
 
189
  $response_body = json_decode( $response->body() );
190
 
191
- if ( isset( $response_body->errors[0]->message ) || $response->statusCode() != 200 ) {
 
192
 
193
- $e = $response->statusCode() != 200 ? sprintf( __( 'ERROR: Status code is %1$s', Postman::TEXT_DOMAIN ), $response->statusCode() ) : $response_body->errors[0]->message;
 
 
194
  $this->transcript = $e;
195
  $this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS;
196
  $this->transcript .= print_r( $mail, true );
@@ -210,6 +213,31 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) {
210
  throw $e;
211
  }
212
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
 
214
  /**
215
  * Add attachments to the message
188
 
189
  $response_body = json_decode( $response->body() );
190
 
191
+ $response_code = $response->statusCode();
192
+ $email_sent = ( $response_code >= 200 and $response_code < 300 );
193
 
194
+ if ( isset( $response_body->errors[0]->message ) || ! $email_sent ) {
195
+
196
+ $e = ! $email_sent ? $this->errorCodesMap($response_code) : $response_body->errors[0]->message;
197
  $this->transcript = $e;
198
  $this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS;
199
  $this->transcript .= print_r( $mail, true );
213
  throw $e;
214
  }
215
  }
216
+
217
+
218
+ private function errorCodesMap($error_code) {
219
+ switch ($error_code) {
220
+ case 413:
221
+ $message = sprintf( __( 'ERROR: The JSON payload you have included in your request is too large. Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code );
222
+ break;
223
+ case 429:
224
+ $message = sprintf( __( 'ERROR: The number of requests you have made exceeds SendGrid rate limitations. Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code );
225
+ break;
226
+ case 500:
227
+ $message = sprintf( __( 'ERROR: An error occurred on a SendGrid server. Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code );
228
+ break;
229
+ case 513:
230
+ $message = sprintf( __( 'ERROR: The SendGrid v3 Web API is not available. Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code );
231
+ break;
232
+ case 502:
233
+ $message = sprintf( __( 'ERROR: No recipient supplied. Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code );
234
+ break;
235
+ default:
236
+ $message = sprintf( __( 'ERROR: Status code is %1$s', Postman::TEXT_DOMAIN ), $error_code );
237
+ }
238
+
239
+ return $message;
240
+ }
241
 
242
  /**
243
  * Add attachments to the message
postman-smtp.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Post SMTP
5
  * Plugin URI: https://wordpress.org/plugins/post-smtp/
6
  * 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!
7
- * Version: 1.8.8
8
  * Author: Jason Hendriks, Yehuda Hassine
9
  * Text Domain: post-smtp
10
  * Author URI: https://postmansmtp.com
@@ -123,5 +123,5 @@ function post_start( $startingMemory ) {
123
  */
124
  function post_setupPostman() {
125
  require_once 'Postman/Postman.php';
126
- $kevinCostner = new Postman( __FILE__, '1.8.8' );
127
  }
4
  * Plugin Name: Post SMTP
5
  * Plugin URI: https://wordpress.org/plugins/post-smtp/
6
  * 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!
7
+ * Version: 1.8.9
8
  * Author: Jason Hendriks, Yehuda Hassine
9
  * Text Domain: post-smtp
10
  * Author URI: https://postmansmtp.com
123
  */
124
  function post_setupPostman() {
125
  require_once 'Postman/Postman.php';
126
+ $kevinCostner = new Postman( __FILE__, '1.8.9' );
127
  }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Post SMTP Mailer/Email Log ===
2
- Contributors: yehudah, jasonhendriks
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=yehuda@myinbox.in&item_name=Donation+for+PostSMTP
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: 4.9.5
7
- Stable tag: 1.8.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -12,7 +12,7 @@ Send, log and troubleshoot your Outgoing Email easily. Supports everything: SMTP
12
 
13
  == Description ==
14
 
15
- = Version 1.8.8 released =
16
  Lockfile, Contact form 7 and raise the PHP version. [Read the detailes here](https://postmansmtp.com/post-smtp-v1-8-6-lockfile-and-raise-the-php-version/)
17
 
18
  = WordPress Mail SMTP Plugin =
@@ -296,6 +296,9 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a
296
 
297
 
298
  == Changelog ==
 
 
 
299
  = 1.8.8 - 2018-04-24
300
  * file added to svn - contactform7
301
 
1
  === Post SMTP Mailer/Email Log ===
2
+ Contributors: yehudah, abdullahramzan, jasonhendriks
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=yehuda@myinbox.in&item_name=Donation+for+PostSMTP
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: 4.9.5
7
+ Stable tag: 1.8.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
12
 
13
  == Description ==
14
 
15
+ = Version 1.8.9 released =
16
  Lockfile, Contact form 7 and raise the PHP version. [Read the detailes here](https://postmansmtp.com/post-smtp-v1-8-6-lockfile-and-raise-the-php-version/)
17
 
18
  = WordPress Mail SMTP Plugin =
296
 
297
 
298
  == Changelog ==
299
+ = 1.8.9 - 2018-04-24
300
+ * Sendgrid bug
301
+
302
  = 1.8.8 - 2018-04-24
303
  * file added to svn - contactform7
304