Post SMTP Mailer/Email Log - Version 1.8.6

Version Description

  • 2018-04-24
  • Fix lockfile erros
  • Contact form 7 integration
  • PHP 5.6 requirement
Download this release

Release Info

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

Code changes from version 1.8.5 to 1.8.6

Postman/Postman-Diagnostic-Test/PostmanDiagnosticTestController.php CHANGED
@@ -209,6 +209,7 @@ class PostmanGetDiagnosticsViaAjax {
209
  */
210
  public function getDiagnostics() {
211
  $transportRegistry = PostmanTransportRegistry::getInstance();
 
212
  $this->addToDiagnostics( 'OS', php_uname() );
213
  $this->addToDiagnostics( 'PHP', PHP_OS . ' ' . PHP_VERSION . ' ' . setlocale( LC_CTYPE, 0 ) );
214
  $this->addToDiagnostics( 'PHP Dependencies', $this->getPhpDependencies() );
209
  */
210
  public function getDiagnostics() {
211
  $transportRegistry = PostmanTransportRegistry::getInstance();
212
+ $this->addToDiagnostics( 'HostName', PostmanUtils::getServerName() );
213
  $this->addToDiagnostics( 'OS', php_uname() );
214
  $this->addToDiagnostics( 'PHP', PHP_OS . ' ' . PHP_VERSION . ' ' . setlocale( LC_CTYPE, 0 ) );
215
  $this->addToDiagnostics( 'PHP Dependencies', $this->getPhpDependencies() );
Postman/Postman-Mail/PostmanContactForm7.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Postsmtp_ContactForm7 {
3
+
4
+ private $result_error;
5
+
6
+ public function __construct() {
7
+ add_action( 'wpcf7_mail_failed', array( $this, 'save_error' ) );
8
+ add_filter( 'wpcf7_ajax_json_echo', array( $this, 'change_rest_response' ), 10, 2 );
9
+ }
10
+
11
+ public function save_error($contact_form) {
12
+ $this->result_error = apply_filters( 'postman_wp_mail_result', null );
13
+ }
14
+
15
+ public function change_rest_response( $response ) {
16
+ if ( $response['status'] == 'mail_failed' ) {
17
+ $message = $this->result_error ['exception']->getMessage();
18
+
19
+ if ( ! $message || $message == '' ) {
20
+ return $response;
21
+ }
22
+
23
+ $currentTransport = PostmanOptions::getInstance()->getTransportType();
24
+ $result = json_decode($message);
25
+ $is_json = (json_last_error() == JSON_ERROR_NONE);
26
+
27
+ switch ($currentTransport) {
28
+ case 'gmail_api':
29
+ $response['message'] = $is_json ? $result->error->message : $message;
30
+ break;
31
+ default:
32
+ $response['message'] = $is_json ? json_encode(json_decode($message), JSON_PRETTY_PRINT) : $message;
33
+ }
34
+ }
35
+
36
+ return $response;
37
+ }
38
+
39
+ }
Postman/Postman-Mail/PostmanMailgunMailEngine.php CHANGED
@@ -20,7 +20,7 @@ if ( ! class_exists( 'PostmanMailgunMailEngine' ) ) {
20
 
21
  private $apiKey;
22
  private $domainName;
23
- private $mandrillMessage;
24
 
25
  /**
26
  *
@@ -153,7 +153,7 @@ if ( ! class_exists( 'PostmanMailgunMailEngine' ) ) {
153
  $result = array();
154
  try {
155
  if ( $this->logger->isDebug() ) {
156
- $this->logger->debug( 'Creating Mandrill service with apiKey=' . $this->apiKey );
157
  }
158
 
159
  // send the message
@@ -184,7 +184,7 @@ if ( ! class_exists( 'PostmanMailgunMailEngine' ) ) {
184
 
185
  private function processSend( $mg ) {
186
 
187
- if ( count( $this->mailgunMessage['to'] ) == 1 ) {
188
 
189
  return $mg->messages()->send( $this->domainName, array_filter( $this->mailgunMessage ) );
190
  } else {
20
 
21
  private $apiKey;
22
  private $domainName;
23
+ private $mailgunMessage;
24
 
25
  /**
26
  *
153
  $result = array();
154
  try {
155
  if ( $this->logger->isDebug() ) {
156
+ $this->logger->debug( 'Creating Mailgun service with apiKey=' . $this->apiKey );
157
  }
158
 
159
  // send the message
184
 
185
  private function processSend( $mg ) {
186
 
187
+ if ( count( $this->mailgunMessage['to'] ) <= 1 ) {
188
 
189
  return $mg->messages()->send( $this->domainName, array_filter( $this->mailgunMessage ) );
190
  } else {
Postman/Postman-Mail/PostmanSendGridMailEngine.php CHANGED
@@ -188,14 +188,16 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) {
188
 
189
  $response_body = json_decode( $response->body() );
190
 
191
- if ( isset( $response_body->errors[0]->message ) ) {
192
- $this->transcript = $response_body->errors[0]->message;
 
 
193
  $this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS;
194
  $this->transcript .= print_r( $mail, true );
195
 
196
  $this->logger->debug( 'Transcript=' . $this->transcript );
197
 
198
- throw new Exception( $response_body->errors[0]->message );
199
  }
200
  $this->transcript = print_r( $response->body(), true );
201
  $this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS;
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 );
197
 
198
  $this->logger->debug( 'Transcript=' . $this->transcript );
199
 
200
+ throw new Exception( $e );
201
  }
202
  $this->transcript = print_r( $response->body(), true );
203
  $this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS;
Postman/Postman.php CHANGED
@@ -54,6 +54,7 @@ class Postman {
54
  require_once 'PostmanConfigTextHelper.php';
55
  require_once 'Postman-Email-Log/PostmanEmailLogPostType.php';
56
  require_once 'Postman-Mail/PostmanMyMailConnector.php';
 
57
  //require_once 'Postman-Mail/PostmanWooCommerce.php';
58
 
59
  // get plugin metadata - alternative to get_plugin_data
@@ -106,6 +107,9 @@ class Postman {
106
  // MyMail integration
107
  new PostmanMyMailConnector( $rootPluginFilenameAndPath );
108
 
 
 
 
109
  // WooCommerce Integration
110
  //new PostmanWoocommerce();
111
 
@@ -153,6 +157,7 @@ class Postman {
153
  $this,
154
  'on_deactivation',
155
  ) );
 
156
  }
157
 
158
  public function post_smtp_wpml_admin_notice() {
@@ -426,7 +431,7 @@ class Postman {
426
  // because __FILE__ returns the wrong path if the plugin is installed as a symlink
427
  $shortLocale = substr( get_locale(), 0, 2 );
428
  if ( $shortLocale != 'en' ) {
429
- $langDir = 'postman-smtp/Postman/languages';
430
  $success = load_plugin_textdomain( Postman::TEXT_DOMAIN, false, $langDir );
431
  if ( $this->logger->isDebug() ) {
432
  if ( $success ) {
54
  require_once 'PostmanConfigTextHelper.php';
55
  require_once 'Postman-Email-Log/PostmanEmailLogPostType.php';
56
  require_once 'Postman-Mail/PostmanMyMailConnector.php';
57
+ require_once 'Postman-Mail/PostmanContactForm7.php';
58
  //require_once 'Postman-Mail/PostmanWooCommerce.php';
59
 
60
  // get plugin metadata - alternative to get_plugin_data
107
  // MyMail integration
108
  new PostmanMyMailConnector( $rootPluginFilenameAndPath );
109
 
110
+ // Contact form 7
111
+ new Postsmtp_ContactForm7;
112
+
113
  // WooCommerce Integration
114
  //new PostmanWoocommerce();
115
 
157
  $this,
158
  'on_deactivation',
159
  ) );
160
+
161
  }
162
 
163
  public function post_smtp_wpml_admin_notice() {
431
  // because __FILE__ returns the wrong path if the plugin is installed as a symlink
432
  $shortLocale = substr( get_locale(), 0, 2 );
433
  if ( $shortLocale != 'en' ) {
434
+ $langDir = 'post-smtp/Postman/languages';
435
  $success = load_plugin_textdomain( Postman::TEXT_DOMAIN, false, $langDir );
436
  if ( $this->logger->isDebug() ) {
437
  if ( $success ) {
Postman/PostmanUtils.php CHANGED
@@ -243,6 +243,9 @@ class PostmanUtils {
243
  return $success;
244
  }
245
  static function createLockFile( $tempDirectory = null ) {
 
 
 
246
  $path = PostmanUtils::calculateTemporaryLockPath( $tempDirectory );
247
  $success = @fopen( $path, 'xb' );
248
  if ( PostmanUtils::$logger->isTrace() ) {
243
  return $success;
244
  }
245
  static function createLockFile( $tempDirectory = null ) {
246
+ if ( self::lockFileExists() ) {
247
+ self::deleteLockFile();
248
+ }
249
  $path = PostmanUtils::calculateTemporaryLockPath( $tempDirectory );
250
  $success = @fopen( $path, 'xb' );
251
  if ( PostmanUtils::$logger->isTrace() ) {
Postman/PostmanViewController.php CHANGED
@@ -57,7 +57,7 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
57
  die();
58
  }
59
 
60
- echo PostmanUtils::deleteLockFile() == true ? __('Success', Postman::TEXT_DOMAIN ) : __('Failed, try again.', Postman::TEXT_DOMAIN );
61
  die();
62
  }
63
 
@@ -307,7 +307,7 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
307
  echo '
308
  <div class="updated settings-error notice is-dismissible">
309
  <p>
310
- <strong>Version ' . $version . ' released with Gmail upgrade and notifications:</strong> <a target="_blank" href="https://postmansmtp.com/post-smtp-1-8-4-best-wordpress-gmail-client">Read Here</a>
311
  </p>
312
  <button style="z-index: 100;" data-version="'. $version . '" data-security="' . wp_create_nonce('postsmtp') .'" type="button" class="notice-dismiss postman-release-message">
313
  <span class="screen-reader-text">Dismiss this notice.</span>
57
  die();
58
  }
59
 
60
+ echo PostmanUtils::deleteLockFile() == true ? __('Success, try to send test email.', Postman::TEXT_DOMAIN ) : __('Failed, try again.', Postman::TEXT_DOMAIN );
61
  die();
62
  }
63
 
307
  echo '
308
  <div class="updated settings-error notice is-dismissible">
309
  <p>
310
+ <strong>Version ' . $version . ' released with lockfile fix and new PHP requirement:</strong> <a target="_blank" href="https://postmansmtp.com/post-smtp-v1-8-6-lockfile-and-raise-the-php-version">Read Here</a>
311
  </p>
312
  <button style="z-index: 100;" data-version="'. $version . '" data-security="' . wp_create_nonce('postsmtp') .'" type="button" class="notice-dismiss postman-release-message">
313
  <span class="screen-reader-text">Dismiss this notice.</span>
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.5
8
  * Author: Jason Hendriks, Yehuda Hassine
9
  * Text Domain: post-smtp
10
  * Author URI: https://postmansmtp.com
@@ -38,9 +38,20 @@
38
  define( 'POST_BASE', __FILE__ );
39
  define( 'POST_PATH', __DIR__ );
40
 
41
- if ( in_array( 'postman-smtp/postman-smtp.php', (array) get_option( 'active_plugins', array() ) ) ) {
 
 
 
42
  add_action( 'admin_init', 'post_smtp_plugin_deactivate' );
43
- add_action( 'admin_notices', 'post_smtp_plugin_admin_notice' );
 
 
 
 
 
 
 
 
44
  } else {
45
  post_start( memory_get_usage() );
46
  }
@@ -50,6 +61,20 @@ function post_smtp_plugin_deactivate() {
50
  deactivate_plugins( plugin_basename( __FILE__ ) );
51
  }
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  function post_smtp_plugin_admin_notice() {
54
  echo '<div class="error"><p><strong>Post SMTP</strong> plugin is a fork (twin brother) of the original Postman SMTP, you must disable Postman SMTP to use this plugin.</p></div>';
55
 
@@ -99,5 +124,5 @@ function post_start( $startingMemory ) {
99
  */
100
  function post_setupPostman() {
101
  require_once 'Postman/Postman.php';
102
- $kevinCostner = new Postman( __FILE__, '1.8.5' );
103
  }
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.6
8
  * Author: Jason Hendriks, Yehuda Hassine
9
  * Text Domain: post-smtp
10
  * Author URI: https://postmansmtp.com
38
  define( 'POST_BASE', __FILE__ );
39
  define( 'POST_PATH', __DIR__ );
40
 
41
+ $postman_smtp_exist = in_array( 'postman-smtp/postman-smtp.php', (array) get_option( 'active_plugins', array() ) );
42
+ $required_php_version = version_compare(PHP_VERSION, '5.6.0', '<');
43
+
44
+ if ( $postman_smtp_exist || $required_php_version ) {
45
  add_action( 'admin_init', 'post_smtp_plugin_deactivate' );
46
+
47
+ if ( $postman_smtp_exist ) {
48
+ add_action( 'admin_notices', 'post_smtp_plugin_admin_notice' );
49
+ }
50
+
51
+ if ( $required_php_version ) {
52
+ add_action( 'admin_notices', 'post_smtp_plugin_admin_notice_version' );
53
+ }
54
+
55
  } else {
56
  post_start( memory_get_usage() );
57
  }
61
  deactivate_plugins( plugin_basename( __FILE__ ) );
62
  }
63
 
64
+ function post_smtp_plugin_admin_notice_version() {
65
+ echo '<div class="error">
66
+ <p>
67
+ <strong>Post SMTP</strong> plugin require at least PHP version 5.6, contact to your web hostig support to upgrade.
68
+ </p>
69
+ <p>
70
+ <a href="https://secure.php.net/supported-versions.php">See supported versions on PHP.net</a>
71
+ </p>
72
+ </div>';
73
+
74
+ if ( isset( $_GET['activate'] ) ) {
75
+ unset( $_GET['activate'] ); }
76
+ }
77
+
78
  function post_smtp_plugin_admin_notice() {
79
  echo '<div class="error"><p><strong>Post SMTP</strong> plugin is a fork (twin brother) of the original Postman SMTP, you must disable Postman SMTP to use this plugin.</p></div>';
80
 
124
  */
125
  function post_setupPostman() {
126
  require_once 'Postman/Postman.php';
127
+ $kevinCostner = new Postman( __FILE__, '1.8.6' );
128
  }
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: 4.9.5
7
- Stable tag: 1.8.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -12,8 +12,8 @@ Send, log and troubleshoot your Outgoing Email easily. Supports everything: SMTP
12
 
13
  == Description ==
14
 
15
- = Version 1.8.5 released =
16
- Making Post SMTP the best Gmail client for WordPress, and a notification feature for failed emails. [Read the detailes here](https://postmansmtp.com/post-smtp-1-8-4-best-wordpress-gmail-client/)
17
 
18
  = WordPress Mail SMTP Plugin =
19
 
@@ -81,7 +81,7 @@ SendGrid has a free SMTP plan that you can use to send up to 100 emails per day.
81
  * .. and every other plugin that uses the WordPress API [wp_mail](https://codex.wordpress.org/Function_Reference/wp_mail) to send mail!
82
 
83
  = Requirements =
84
- * WordPress 3.9 and PHP 5.2 with SPL and iconv
85
  * Memory: 750KiB per process at idle
86
  * Reliable mail delivery with custom email domains requires an SPF record
87
  * Reliable SMTP delivery requires credentials with an email service provider
@@ -297,6 +297,11 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a
297
 
298
  == Changelog ==
299
 
 
 
 
 
 
300
  = 1.8.5 - 2018-04-19
301
  * Remove Beta Woocommerce integration
302
  * Better check for WPML less then version 3.9
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.6
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.6 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 =
19
 
81
  * .. and every other plugin that uses the WordPress API [wp_mail](https://codex.wordpress.org/Function_Reference/wp_mail) to send mail!
82
 
83
  = Requirements =
84
+ * WordPress 3.9 and PHP 5.6 with SPL and iconv
85
  * Memory: 750KiB per process at idle
86
  * Reliable mail delivery with custom email domains requires an SPF record
87
  * Reliable SMTP delivery requires credentials with an email service provider
297
 
298
  == Changelog ==
299
 
300
+ = 1.8.6 - 2018-04-24
301
+ * Fix lockfile erros
302
+ * Contact form 7 integration
303
+ * PHP 5.6 requirement
304
+
305
  = 1.8.5 - 2018-04-19
306
  * Remove Beta Woocommerce integration
307
  * Better check for WPML less then version 3.9
style/testEmail.html CHANGED
@@ -25,7 +25,7 @@
25
  <div
26
  style="max-width: 600px; height: 400px; margin: 0 auto; overflow: hidden;background-image:url('http://plugins.svn.wordpress.org/postman-smtp/assets/email/poofytoo.png');background-repeat: no-repeat;">
27
  <div style="margin:50px 0 0 300px; width:300px; font-size:2em;">Hello! - 你好 - Bonjour! - नमस्ते - ¡Hola! - Olá - Привет! - 今日は</div>
28
- <div style="text-align:right;font-size: 1.4em; color:black;margin:150px 0 0 200px;">Sent by <em>Postman</em> v1.5.6<br/><span style="font-size: 0.8em"><a style="color:#3f73b9" href="https://wordpress.org/plugins/postman-smtp/">https://wordpress.org/plugins/postman-smtp/</a></span></div>
29
  </div>
30
  </td>
31
  </tr>
25
  <div
26
  style="max-width: 600px; height: 400px; margin: 0 auto; overflow: hidden;background-image:url('http://plugins.svn.wordpress.org/postman-smtp/assets/email/poofytoo.png');background-repeat: no-repeat;">
27
  <div style="margin:50px 0 0 300px; width:300px; font-size:2em;">Hello! - 你好 - Bonjour! - नमस्ते - ¡Hola! - Olá - Привет! - 今日は</div>
28
+ <div style="text-align:right;font-size: 1.4em; color:black;margin:150px 0 0 200px;">Sent by <em>Postman</em> v1.5.6<br/><span style="font-size: 0.8em"><a style="color:#3f73b9" href="https://wordpress.org/plugins/post-smtp/">https://wordpress.org/plugins/post-smtp/</a></span></div>
29
  </div>
30
  </td>
31
  </tr>