WP Mail SMTP by WPForms - Version 1.2.2

Version Description

  • 2017-12-27 =
  • Fixed: Correctly handle Mailgun debug message for an incorrect api key.
  • Fixed: Fatal error for Gmail and SMTP mailers with Nginx web-server (without Apache at all).
  • Changed: Update X-Mailer emails header to show the real sender with a mailer and plugin version.
Download this release

Release Info

Developer slaFFik
Plugin Icon 128x128 WP Mail SMTP by WPForms
Version 1.2.2
Comparing to
See all releases

Code changes from version 1.2.1 to 1.2.2

readme.txt CHANGED
@@ -146,6 +146,11 @@ By all means please contact us to discuss features or options you'd like to see
146
 
147
  == Changelog ==
148
 
 
 
 
 
 
149
  = 1.2.1 - 2017-12-21 =
150
  * Fixed: Failed SMTP connections generate fatal errors.
151
 
146
 
147
  == Changelog ==
148
 
149
+ = 1.2.2 - 2017-12-27 =
150
+ * Fixed: Correctly handle Mailgun debug message for an incorrect api key.
151
+ * Fixed: Fatal error for Gmail and SMTP mailers with Nginx web-server (without Apache at all).
152
+ * Changed: Update X-Mailer emails header to show the real sender with a mailer and plugin version.
153
+
154
  = 1.2.1 - 2017-12-21 =
155
  * Fixed: Failed SMTP connections generate fatal errors.
156
 
src/MailCatcher.php CHANGED
@@ -31,6 +31,9 @@ class MailCatcher extends \PHPMailer {
31
  $options = new Options();
32
  $mailer = $options->get( 'mail', 'mailer' );
33
 
 
 
 
34
  // Use the default PHPMailer, as we inject our settings there for certain providers.
35
  if (
36
  $mailer === 'mail' ||
31
  $options = new Options();
32
  $mailer = $options->get( 'mail', 'mailer' );
33
 
34
+ // Define a custom header, that will be used in Gmail/SMTP mailers.
35
+ $this->XMailer = 'WPMailSMTP/Mailer/' . $mailer . ' ' . WPMS_PLUGIN_VER;
36
+
37
  // Use the default PHPMailer, as we inject our settings there for certain providers.
38
  if (
39
  $mailer === 'mail' ||
src/Providers/Gmail/Mailer.php CHANGED
@@ -3,8 +3,8 @@
3
  namespace WPMailSMTP\Providers\Gmail;
4
 
5
  use WPMailSMTP\Debug;
 
6
  use WPMailSMTP\Providers\MailerAbstract;
7
- use WPMailSMTP\WP;
8
 
9
  /**
10
  * Class Mailer.
@@ -66,7 +66,7 @@ class Mailer extends MailerAbstract {
66
  public function process_phpmailer( $phpmailer ) {
67
  // Make sure that we have access to MailCatcher class methods.
68
  if (
69
- ! $phpmailer instanceof \WPMailSMTP\MailCatcher &&
70
  ! $phpmailer instanceof \PHPMailer
71
  ) {
72
  return;
@@ -83,10 +83,9 @@ class Mailer extends MailerAbstract {
83
  public function send() {
84
 
85
  // Get the raw MIME email using \PHPMailer data.
86
- $mime = $this->phpmailer->getSentMIMEMessage();
87
- $data = base64_encode( $mime );
88
- $data = str_replace( array( '+', '/', '=' ), array( '-', '_', '' ), $data ); // url safe.
89
- $this->message->setRaw( $data );
90
 
91
  $service = new \Google_Service_Gmail( $this->auth->get_client() );
92
 
@@ -153,7 +152,10 @@ class Mailer extends MailerAbstract {
153
  $gmail_text[] = '<strong>PHP.stream_socket_client():</strong> ' . ( function_exists( 'stream_socket_client' ) ? 'Yes' : 'No' );
154
  $gmail_text[] = '<strong>PHP.fsockopen():</strong> ' . ( function_exists( 'fsockopen' ) ? 'Yes' : 'No' );
155
  $gmail_text[] = '<strong>PHP.curl_version():</strong> ' . ( function_exists( 'curl_version' ) ? 'Yes' : 'No' );
156
- $gmail_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', apache_get_modules(), true ) || in_array( 'mod_security2', apache_get_modules(), true ) ? 'Yes' : 'No' );
 
 
 
157
 
158
  return implode( '<br>', $gmail_text );
159
  }
3
  namespace WPMailSMTP\Providers\Gmail;
4
 
5
  use WPMailSMTP\Debug;
6
+ use WPMailSMTP\MailCatcher;
7
  use WPMailSMTP\Providers\MailerAbstract;
 
8
 
9
  /**
10
  * Class Mailer.
66
  public function process_phpmailer( $phpmailer ) {
67
  // Make sure that we have access to MailCatcher class methods.
68
  if (
69
+ ! $phpmailer instanceof MailCatcher &&
70
  ! $phpmailer instanceof \PHPMailer
71
  ) {
72
  return;
83
  public function send() {
84
 
85
  // Get the raw MIME email using \PHPMailer data.
86
+ $base64 = base64_encode( $this->phpmailer->getSentMIMEMessage() );
87
+ $base64 = str_replace( array( '+', '/', '=' ), array( '-', '_', '' ), $base64 ); // url safe.
88
+ $this->message->setRaw( $base64 );
 
89
 
90
  $service = new \Google_Service_Gmail( $this->auth->get_client() );
91
 
152
  $gmail_text[] = '<strong>PHP.stream_socket_client():</strong> ' . ( function_exists( 'stream_socket_client' ) ? 'Yes' : 'No' );
153
  $gmail_text[] = '<strong>PHP.fsockopen():</strong> ' . ( function_exists( 'fsockopen' ) ? 'Yes' : 'No' );
154
  $gmail_text[] = '<strong>PHP.curl_version():</strong> ' . ( function_exists( 'curl_version' ) ? 'Yes' : 'No' );
155
+ if ( function_exists( 'apache_get_modules' ) ) {
156
+ $modules = apache_get_modules();
157
+ $gmail_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', $modules, true ) || in_array( 'mod_security2', $modules, true ) ? 'Yes' : 'No' );
158
+ }
159
 
160
  return implode( '<br>', $gmail_text );
161
  }
src/Providers/Mail/Mailer.php CHANGED
@@ -25,7 +25,10 @@ class Mailer extends MailerAbstract {
25
  $disabled = (array) explode( ',', trim( $disabled_functions ) );
26
 
27
  $mail_text[] = '<strong>PHP.mail():</strong> ' . ( in_array( 'mail', $disabled, true ) || ! function_exists( 'mail' ) ? 'No' : 'Yes' );
28
- $mail_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', apache_get_modules(), true ) || in_array( 'mod_security2', apache_get_modules(), true ) ? 'Yes' : 'No' );
 
 
 
29
 
30
  return implode( '<br>', $mail_text );
31
  }
25
  $disabled = (array) explode( ',', trim( $disabled_functions ) );
26
 
27
  $mail_text[] = '<strong>PHP.mail():</strong> ' . ( in_array( 'mail', $disabled, true ) || ! function_exists( 'mail' ) ? 'No' : 'Yes' );
28
+ if ( function_exists( 'apache_get_modules' ) ) {
29
+ $modules = apache_get_modules();
30
+ $mail_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', $modules, true ) || in_array( 'mod_security2', $modules, true ) ? 'Yes' : 'No' );
31
+ }
32
 
33
  return implode( '<br>', $mail_text );
34
  }
src/Providers/MailerAbstract.php CHANGED
@@ -403,6 +403,13 @@ abstract class MailerAbstract implements MailerInterface {
403
  }
404
  }
405
 
 
 
 
 
 
 
 
406
  return implode( '<br>', $smtp_text );
407
  }
408
  }
403
  }
404
  }
405
 
406
+ $smtp_text[] = '<br><strong>Server:</strong>';
407
+ $smtp_text[] = '<strong>OpenSSL:</strong> ' . ( extension_loaded( 'openssl' ) ? 'Yes' : 'No' );
408
+ if ( function_exists( 'apache_get_modules' ) ) {
409
+ $modules = apache_get_modules();
410
+ $smtp_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', $modules, true ) || in_array( 'mod_security2', $modules, true ) ? 'Yes' : 'No' );
411
+ }
412
+
413
  return implode( '<br>', $smtp_text );
414
  }
415
  }
src/Providers/Mailgun/Mailer.php CHANGED
@@ -311,10 +311,16 @@ class Mailer extends MailerAbstract {
311
  $error_text = array();
312
 
313
  if ( ! empty( $body['message'] ) ) {
314
- if ( ! is_string( $body['message'] ) ) {
 
 
315
  $error_text[] = \json_encode( $body['message'] );
 
 
 
 
316
  } else {
317
- $error_text[] = $body['message'];
318
  }
319
  }
320
 
311
  $error_text = array();
312
 
313
  if ( ! empty( $body['message'] ) ) {
314
+ if ( is_string( $body['message'] ) ) {
315
+ $error_text[] = $body['message'];
316
+ } else {
317
  $error_text[] = \json_encode( $body['message'] );
318
+ }
319
+ } elseif ( ! empty( $body[0] ) ) {
320
+ if ( is_string( $body[0] ) ) {
321
+ $error_text[] = $body[0];
322
  } else {
323
+ $error_text[] = \json_encode( $body[0] );
324
  }
325
  }
326
 
wp_mail_smtp.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * Plugin Name: WP Mail SMTP
4
- * Version: 1.2.1
5
  * Plugin URI: https://wpforms.com/
6
  * Description: Reconfigures the wp_mail() function to use SMTP instead of mail() and creates an options page to manage the settings.
7
  * Author: WPForms
@@ -17,7 +17,7 @@
17
  * http://www.gnu.org/licenses/gpl.txt
18
  */
19
 
20
- define( 'WPMS_PLUGIN_VER', '1.2.1' );
21
  define( 'WPMS_PHP_VER', '5.3' );
22
 
23
  /**
1
  <?php
2
  /**
3
  * Plugin Name: WP Mail SMTP
4
+ * Version: 1.2.2
5
  * Plugin URI: https://wpforms.com/
6
  * Description: Reconfigures the wp_mail() function to use SMTP instead of mail() and creates an options page to manage the settings.
7
  * Author: WPForms
17
  * http://www.gnu.org/licenses/gpl.txt
18
  */
19
 
20
+ define( 'WPMS_PLUGIN_VER', '1.2.2' );
21
  define( 'WPMS_PHP_VER', '5.3' );
22
 
23
  /**