Easy WP SMTP - Version 1.2.1

Version Description

  • Set SMTPAutoTLS to false by default as it might cause issues if the server is advertising TLS with an invalid certificate.
  • Display an error message near the top of admin pages if SMTP credentials are not configured.
Download this release

Release Info

Developer wpecommerce
Plugin Icon 128x128 Easy WP SMTP
Version 1.2.1
Comparing to
See all releases

Code changes from version 1.2.0 to 1.2.1

Files changed (2) hide show
  1. easy-wp-smtp.php +41 -2
  2. readme.txt +7 -2
easy-wp-smtp.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Easy WP SMTP
4
- Version: 1.2.0
5
  Plugin URI: https://wp-ecommerce.net/easy-wordpress-smtp-send-emails-from-your-wordpress-site-using-a-smtp-server-2197
6
  Author: wpecommerce
7
  Author URI: https://wp-ecommerce.net/
@@ -120,7 +120,11 @@ if ( ! function_exists ( 'swpsmtp_admin_head' ) ) {
120
  * @return void
121
  */
122
  if ( ! function_exists ( 'swpsmtp_init_smtp' ) ) {
123
- function swpsmtp_init_smtp( $phpmailer ) {
 
 
 
 
124
  $swpsmtp_options = get_option( 'swpsmtp_options' );
125
  /* Set the mailer type as per config above, this overrides the already called isMail method */
126
  $phpmailer->IsSMTP();
@@ -144,6 +148,8 @@ if ( ! function_exists ( 'swpsmtp_init_smtp' ) ) {
144
  $phpmailer->Username = $swpsmtp_options['smtp_settings']['username'];
145
  $phpmailer->Password = swpsmtp_get_password();
146
  }
 
 
147
  }
148
  }
149
 
@@ -338,6 +344,9 @@ if ( ! function_exists( 'swpsmtp_settings' ) ) {
338
  */
339
  if ( ! function_exists( 'swpsmtp_test_mail' ) ) {
340
  function swpsmtp_test_mail( $to_email, $subject, $message ) {
 
 
 
341
  $errors = '';
342
 
343
  $swpsmtp_options = get_option( 'swpsmtp_options' );
@@ -364,6 +373,9 @@ if ( ! function_exists( 'swpsmtp_test_mail' ) ) {
364
  if ( $swpsmtp_options['smtp_settings']['type_encryption'] !== 'none' ) {
365
  $mail->SMTPSecure = $swpsmtp_options['smtp_settings']['type_encryption'];
366
  }
 
 
 
367
 
368
  /* Set the other options */
369
  $mail->Host = $swpsmtp_options['smtp_settings']['host'];
@@ -429,6 +441,32 @@ if ( ! function_exists( 'swpsmtp_get_password' ) ) {
429
  }
430
  }
431
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
432
 
433
  /**
434
  * Add all hooks
@@ -443,5 +481,6 @@ add_action( 'admin_menu', 'swpsmtp_admin_default_setup' );
443
 
444
  add_action( 'admin_init', 'swpsmtp_admin_init' );
445
  add_action( 'admin_enqueue_scripts', 'swpsmtp_admin_head' );
 
446
 
447
  register_uninstall_hook( plugin_basename( __FILE__ ), 'swpsmtp_send_uninstall' );
1
  <?php
2
  /*
3
  Plugin Name: Easy WP SMTP
4
+ Version: 1.2.1
5
  Plugin URI: https://wp-ecommerce.net/easy-wordpress-smtp-send-emails-from-your-wordpress-site-using-a-smtp-server-2197
6
  Author: wpecommerce
7
  Author URI: https://wp-ecommerce.net/
120
  * @return void
121
  */
122
  if ( ! function_exists ( 'swpsmtp_init_smtp' ) ) {
123
+ function swpsmtp_init_smtp( $phpmailer ) {
124
+ //check if SMTP credentials have been configured.
125
+ if(!swpsmtp_credentials_configured()){
126
+ return;
127
+ }
128
  $swpsmtp_options = get_option( 'swpsmtp_options' );
129
  /* Set the mailer type as per config above, this overrides the already called isMail method */
130
  $phpmailer->IsSMTP();
148
  $phpmailer->Username = $swpsmtp_options['smtp_settings']['username'];
149
  $phpmailer->Password = swpsmtp_get_password();
150
  }
151
+ //PHPMailer 5.2.10 introduced this option. However, this might cause issues if the server is advertising TLS with an invalid certificate.
152
+ $phpmailer->SMTPAutoTLS = false;
153
  }
154
  }
155
 
344
  */
345
  if ( ! function_exists( 'swpsmtp_test_mail' ) ) {
346
  function swpsmtp_test_mail( $to_email, $subject, $message ) {
347
+ if(!swpsmtp_credentials_configured()){
348
+ return;
349
+ }
350
  $errors = '';
351
 
352
  $swpsmtp_options = get_option( 'swpsmtp_options' );
373
  if ( $swpsmtp_options['smtp_settings']['type_encryption'] !== 'none' ) {
374
  $mail->SMTPSecure = $swpsmtp_options['smtp_settings']['type_encryption'];
375
  }
376
+
377
+ /* PHPMailer 5.2.10 introduced this option. However, this might cause issues if the server is advertising TLS with an invalid certificate. */
378
+ $mail->SMTPAutoTLS = false;
379
 
380
  /* Set the other options */
381
  $mail->Host = $swpsmtp_options['smtp_settings']['host'];
441
  }
442
  }
443
 
444
+ if ( ! function_exists( 'swpsmtp_admin_notice' ) ) {
445
+ function swpsmtp_admin_notice() {
446
+ if(!swpsmtp_credentials_configured()){
447
+ ?>
448
+ <div class="error">
449
+ <p><?php _e( 'Please configure your SMTP credentials in the settings in order to send email using Easy WP SMTP plugin.', 'easy-wp-smtp' ); ?></p>
450
+ </div>
451
+ <?php
452
+ }
453
+ }
454
+ }
455
+
456
+ if ( ! function_exists( 'swpsmtp_credentials_configured' ) ) {
457
+ function swpsmtp_credentials_configured() {
458
+ $swpsmtp_options = get_option( 'swpsmtp_options' );
459
+ $credentials_configured = true;
460
+ if(!isset($swpsmtp_options['from_email_field']) || empty($swpsmtp_options['from_email_field'])){
461
+ $credentials_configured = false;
462
+ }
463
+ if(!isset($swpsmtp_options['from_name_field']) || empty($swpsmtp_options['from_name_field'])){
464
+ $credentials_configured = false;;
465
+ }
466
+ return $credentials_configured;
467
+ }
468
+ }
469
+
470
 
471
  /**
472
  * Add all hooks
481
 
482
  add_action( 'admin_init', 'swpsmtp_admin_init' );
483
  add_action( 'admin_enqueue_scripts', 'swpsmtp_admin_head' );
484
+ add_action( 'admin_notices', 'swpsmtp_admin_notice' );
485
 
486
  register_uninstall_hook( plugin_basename( __FILE__ ), 'swpsmtp_send_uninstall' );
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: wpecommerce
3
  Donate link: https://wp-ecommerce.net/easy-wordpress-smtp-send-emails-from-your-wordpress-site-using-a-smtp-server-2197
4
  Tags: mail, wordpress smtp, phpmailer, smtp, wp_mail, email, gmail, outgoing mail, privacy, security, sendmail, ssl, tls, wp-phpmailer, mail smtp, wp smtp
5
- Requires at least: 3.0
6
  Tested up to: 4.3
7
- Stable tag: 1.2.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -75,6 +75,11 @@ Inspired by [WP Mail SMTP](http://wordpress.org/plugins/wp-mail-smtp/) plugin
75
 
76
  == Changelog ==
77
 
 
 
 
 
 
78
  = 1.2.0 =
79
 
80
  * Set email charset to utf-8 for test email functionality.
2
  Contributors: wpecommerce
3
  Donate link: https://wp-ecommerce.net/easy-wordpress-smtp-send-emails-from-your-wordpress-site-using-a-smtp-server-2197
4
  Tags: mail, wordpress smtp, phpmailer, smtp, wp_mail, email, gmail, outgoing mail, privacy, security, sendmail, ssl, tls, wp-phpmailer, mail smtp, wp smtp
5
+ Requires at least: 4.3
6
  Tested up to: 4.3
7
+ Stable tag: 1.2.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
75
 
76
  == Changelog ==
77
 
78
+ = 1.2.1 =
79
+
80
+ * Set SMTPAutoTLS to false by default as it might cause issues if the server is advertising TLS with an invalid certificate.
81
+ * Display an error message near the top of admin pages if SMTP credentials are not configured.
82
+
83
  = 1.2.0 =
84
 
85
  * Set email charset to utf-8 for test email functionality.