Easy WP SMTP - Version 1.0.9

Version Description

  • Fixed some bugs in the SMTP configuration and mail functionality
Download this release

Release Info

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

Code changes from version 1.0.8 to 1.0.9

Files changed (2) hide show
  1. easy-wp-smtp.php +14 -77
  2. readme.txt +6 -2
easy-wp-smtp.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Easy WP SMTP
4
- Version: 1.0.8
5
  Plugin URI: http://wp-ecommerce.net/?p=2197
6
  Author: wpecommerce
7
  Author URI: http://wp-ecommerce.net/
@@ -26,16 +26,9 @@ if ( ! function_exists( 'swpsmtp_admin_default_setup' ) ) {
26
  */
27
  if ( ! function_exists ( 'swpsmtp_admin_init' ) ) {
28
  function swpsmtp_admin_init() {
29
- global $swpsmtp_plugin_info;
30
  /* Internationalization, first(!) */
31
  load_plugin_textdomain( 'easy_wp_smtp', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
32
 
33
- if ( ! $swpsmtp_plugin_info )
34
- $swpsmtp_plugin_info = get_plugin_data( __FILE__ );
35
-
36
- /* check WordPress version */
37
- swpsmtp_version_check();
38
-
39
  if ( isset( $_REQUEST['page'] ) && 'swpsmtp_settings' == $_REQUEST['page'] ) {
40
  /* register plugin settings */
41
  swpsmtp_register_settings();
@@ -43,36 +36,13 @@ if ( ! function_exists ( 'swpsmtp_admin_init' ) ) {
43
  }
44
  }
45
 
46
- /**
47
- * Function check if plugin is compatible with current WP version
48
- * @return void
49
- */
50
- if ( ! function_exists ( 'swpsmtp_version_check' ) ) {
51
- function swpsmtp_version_check() {
52
- global $wp_version, $swpsmtp_plugin_info;
53
- $require_wp = "3.5"; /* Wordpress at least requires version */
54
- $plugin = plugin_basename( __FILE__ );
55
- if ( version_compare( $wp_version, $require_wp, "<" ) ) {
56
- if ( is_plugin_active( $plugin ) ) {
57
- deactivate_plugins( $plugin );
58
- wp_die( "<strong>" . $swpsmtp_plugin_info['Name'] . " </strong> " . __( 'requires', 'easy_wp_smtp' ) . " <strong>WordPress " . $require_wp . "</strong> " . __( 'or higher, that is why it has been deactivated! Please upgrade WordPress and try again.', 'easy_wp_smtp') . "<br /><br />" . __( 'Back to the WordPress', 'easy_wp_smtp') . " <a href='" . get_admin_url( null, 'plugins.php' ) . "'>" . __( 'Plugins page', 'easy_wp_smtp') . "</a>." );
59
- }
60
- }
61
- }
62
- }
63
-
64
  /**
65
  * Register settings function
66
  * @return void
67
  */
68
  if ( ! function_exists( 'swpsmtp_register_settings' ) ) {
69
  function swpsmtp_register_settings() {
70
- global $wpmu, $wpdb, $swpsmtp_options, $swpsmtp_options_default, $swpsmtp_plugin_info;
71
-
72
- $swpsmtp_plugin_info = get_plugin_data( __FILE__, false );
73
-
74
  $swpsmtp_options_default = array(
75
- 'plugin_option_version' => $swpsmtp_plugin_info["Version"],
76
  'from_email_field' => '',
77
  'from_name_field' => '',
78
  'smtp_settings' => array(
@@ -86,23 +56,9 @@ if ( ! function_exists( 'swpsmtp_register_settings' ) ) {
86
  );
87
 
88
  /* install the default plugin options */
89
- if ( 1 == $wpmu ) {
90
- if ( ! get_site_option( 'swpsmtp_options' ) )
91
- add_site_option( 'swpsmtp_options', $swpsmtp_options_default, '', 'yes' );
92
- } else {
93
- if ( ! get_option( 'swpsmtp_options' ) )
94
- add_option( 'swpsmtp_options', $swpsmtp_options_default, '', 'yes' );
95
- }
96
-
97
- /* get plugin options from the database */
98
- $swpsmtp_options = is_multisite() ? get_site_option( 'swpsmtp_options' ) : get_option( 'swpsmtp_options' );
99
- //$swpsmtp_options = get_option( 'swpsmtp_options' );
100
-
101
- if ( $swpsmtp_options['plugin_option_version'] != $swpsmtp_plugin_info["Version"] ) {
102
- $swpsmtp_options = array_merge( $swpsmtp_options_default, $swpsmtp_options );
103
- $swpsmtp_options['plugin_option_version'] = $swpsmtp_plugin_info["Version"];
104
- update_option( 'swpsmtp_options', $swpsmtp_options );
105
- }
106
  }
107
  }
108
 
@@ -164,21 +120,15 @@ if ( ! function_exists ( 'swpsmtp_admin_head' ) ) {
164
  * @return void
165
  */
166
  if ( ! function_exists ( 'swpsmtp_init_smtp' ) ) {
167
- function swpsmtp_init_smtp( $phpmailer ) {
168
- global $wpmu, $swpsmtp_options;
169
-
170
- if ( empty( $swpsmtp_options ) ) {
171
- $swpsmtp_options = ( 1 == $wpmu ) ? get_site_option( 'swpsmtp_options' ) : get_option( 'swpsmtp_options' );
172
- }
173
 
174
- /* Check that mailer is not blank, and if mailer=smtp, host is not blank */
175
- if ( $swpsmtp_options['smtp_settings']['host'] == '' ) {
176
- return;
177
- }
178
 
179
  /* Set the mailer type as per config above, this overrides the already called isMail method */
180
  $phpmailer->IsSMTP();
181
-
 
 
182
  /* Set the SMTPSecure value */
183
  if ( $swpsmtp_options['smtp_settings']['type_encryption'] !== 'none' ) {
184
  $phpmailer->SMTPSecure = $swpsmtp_options['smtp_settings']['type_encryption'];
@@ -203,13 +153,10 @@ if ( ! function_exists ( 'swpsmtp_init_smtp' ) ) {
203
  */
204
  if ( ! function_exists( 'swpsmtp_settings' ) ) {
205
  function swpsmtp_settings() {
206
- global $wp_version, $wpdb, $wpmu, $swpsmtp_options, $swpsmtp_options_default, $title, $swpsmtp_plugin_info;
207
  $display_add_options = $message = $error = $result = '';
208
 
209
- if ( empty( $swpsmtp_options ) ) {
210
- $swpsmtp_options = ( 1 == $wpmu ) ? get_site_option( 'swpsmtp_options' ) : get_option( 'swpsmtp_options' );
211
- }
212
-
213
  if ( isset( $_POST['swpsmtp_form_submit'] ) && check_admin_referer( plugin_basename( __FILE__ ), 'swpsmtp_nonce_name' ) ) {
214
  /* Update settings */
215
  $swpsmtp_options['from_name_field'] = isset( $_POST['swpsmtp_from_name'] ) ? $_POST['swpsmtp_from_name'] : '';
@@ -236,17 +183,11 @@ if ( ! function_exists( 'swpsmtp_settings' ) ) {
236
  } else {
237
  $swpsmtp_options['smtp_settings']['port'] = $_POST['swpsmtp_smtp_port'];
238
  }
239
- } else {
240
- $swpsmtp_options['smtp_settings']['port'] = $swpsmtp_options_default['smtp_settings']['port'];
241
  }
242
 
243
  /* Update settings in the database */
244
  if ( empty( $error ) ) {
245
- if ( is_multisite() ) {
246
- update_site_option( 'swpsmtp_options', $swpsmtp_options );
247
- } else {
248
- update_option( 'swpsmtp_options', $swpsmtp_options );
249
- }
250
  $message .= __( "Settings saved.", 'easy_wp_smtp' );
251
  }
252
  else{
@@ -396,11 +337,9 @@ if ( ! function_exists( 'swpsmtp_settings' ) ) {
396
  */
397
  if ( ! function_exists( 'swpsmtp_test_mail' ) ) {
398
  function swpsmtp_test_mail( $to_email, $subject, $message ) {
399
- global $swpsmtp_options, $wpmu;
400
  $errors = '';
401
 
402
- if( empty( $swpsmtp_options ) )
403
- $swpsmtp_options = ( 1 == $wpmu ) ? get_site_option( 'swpsmtp_options' ) : get_option( 'swpsmtp_options' );
404
 
405
  require_once( ABSPATH . WPINC . '/class-phpmailer.php' );
406
  $mail = new PHPMailer();
@@ -431,7 +370,7 @@ if ( ! function_exists( 'swpsmtp_test_mail' ) ) {
431
  $mail->MsgHTML( $message );
432
  $mail->AddAddress( $to_email );
433
  $mail->SMTPDebug = 0;
434
-
435
  /* Send mail and return result */
436
  if ( ! $mail->Send() )
437
  $errors = $mail->ErrorInfo;
@@ -454,8 +393,6 @@ if ( ! function_exists( 'swpsmtp_test_mail' ) ) {
454
  */
455
  if ( ! function_exists( 'swpsmtp_send_uninstall' ) ) {
456
  function swpsmtp_send_uninstall() {
457
- global $wpdb;
458
-
459
  /* delete plugin options */
460
  delete_site_option( 'swpsmtp_options' );
461
  delete_option( 'swpsmtp_options' );
1
  <?php
2
  /*
3
  Plugin Name: Easy WP SMTP
4
+ Version: 1.0.9
5
  Plugin URI: http://wp-ecommerce.net/?p=2197
6
  Author: wpecommerce
7
  Author URI: http://wp-ecommerce.net/
26
  */
27
  if ( ! function_exists ( 'swpsmtp_admin_init' ) ) {
28
  function swpsmtp_admin_init() {
 
29
  /* Internationalization, first(!) */
30
  load_plugin_textdomain( 'easy_wp_smtp', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
31
 
 
 
 
 
 
 
32
  if ( isset( $_REQUEST['page'] ) && 'swpsmtp_settings' == $_REQUEST['page'] ) {
33
  /* register plugin settings */
34
  swpsmtp_register_settings();
36
  }
37
  }
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  /**
40
  * Register settings function
41
  * @return void
42
  */
43
  if ( ! function_exists( 'swpsmtp_register_settings' ) ) {
44
  function swpsmtp_register_settings() {
 
 
 
 
45
  $swpsmtp_options_default = array(
 
46
  'from_email_field' => '',
47
  'from_name_field' => '',
48
  'smtp_settings' => array(
56
  );
57
 
58
  /* install the default plugin options */
59
+ if ( ! get_option( 'swpsmtp_options' ) ){
60
+ add_option( 'swpsmtp_options', $swpsmtp_options_default, '', 'yes' );
61
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
63
  }
64
 
120
  * @return void
121
  */
122
  if ( ! function_exists ( 'swpsmtp_init_smtp' ) ) {
123
+ function swpsmtp_init_smtp( $phpmailer ) {
 
 
 
 
 
124
 
125
+ $swpsmtp_options = get_option( 'swpsmtp_options' );
 
 
 
126
 
127
  /* Set the mailer type as per config above, this overrides the already called isMail method */
128
  $phpmailer->IsSMTP();
129
+ $from_email = $swpsmtp_options['from_email_field'];
130
+ $from_name = $swpsmtp_options['from_name_field'];
131
+ $phpmailer->SetFrom( $from_email, $from_name );
132
  /* Set the SMTPSecure value */
133
  if ( $swpsmtp_options['smtp_settings']['type_encryption'] !== 'none' ) {
134
  $phpmailer->SMTPSecure = $swpsmtp_options['smtp_settings']['type_encryption'];
153
  */
154
  if ( ! function_exists( 'swpsmtp_settings' ) ) {
155
  function swpsmtp_settings() {
 
156
  $display_add_options = $message = $error = $result = '';
157
 
158
+ $swpsmtp_options = get_option( 'swpsmtp_options' );
159
+
 
 
160
  if ( isset( $_POST['swpsmtp_form_submit'] ) && check_admin_referer( plugin_basename( __FILE__ ), 'swpsmtp_nonce_name' ) ) {
161
  /* Update settings */
162
  $swpsmtp_options['from_name_field'] = isset( $_POST['swpsmtp_from_name'] ) ? $_POST['swpsmtp_from_name'] : '';
183
  } else {
184
  $swpsmtp_options['smtp_settings']['port'] = $_POST['swpsmtp_smtp_port'];
185
  }
 
 
186
  }
187
 
188
  /* Update settings in the database */
189
  if ( empty( $error ) ) {
190
+ update_option( 'swpsmtp_options', $swpsmtp_options );
 
 
 
 
191
  $message .= __( "Settings saved.", 'easy_wp_smtp' );
192
  }
193
  else{
337
  */
338
  if ( ! function_exists( 'swpsmtp_test_mail' ) ) {
339
  function swpsmtp_test_mail( $to_email, $subject, $message ) {
 
340
  $errors = '';
341
 
342
+ $swpsmtp_options = get_option( 'swpsmtp_options' );
 
343
 
344
  require_once( ABSPATH . WPINC . '/class-phpmailer.php' );
345
  $mail = new PHPMailer();
370
  $mail->MsgHTML( $message );
371
  $mail->AddAddress( $to_email );
372
  $mail->SMTPDebug = 0;
373
+
374
  /* Send mail and return result */
375
  if ( ! $mail->Send() )
376
  $errors = $mail->ErrorInfo;
393
  */
394
  if ( ! function_exists( 'swpsmtp_send_uninstall' ) ) {
395
  function swpsmtp_send_uninstall() {
 
 
396
  /* delete plugin options */
397
  delete_site_option( 'swpsmtp_options' );
398
  delete_option( 'swpsmtp_options' );
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Easy WP SMTP ===
2
  Contributors: wpecommerce
3
  Donate link: http://wp-ecommerce.net/?p=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: 3.9
7
- Stable tag: 1.0.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -75,6 +75,10 @@ Inspired by [WP Mail SMTP](http://wordpress.org/plugins/wp-mail-smtp/) plugin
75
 
76
  == Changelog ==
77
 
 
 
 
 
78
  = 1.0.8 =
79
 
80
  * Plugin now works with WordPress 3.9
1
  === Easy WP SMTP ===
2
  Contributors: wpecommerce
3
  Donate link: http://wp-ecommerce.net/?p=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: 3.9
7
+ Stable tag: 1.0.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
75
 
76
  == Changelog ==
77
 
78
+ = 1.0.9 =
79
+
80
+ * Fixed some bugs in the SMTP configuration and mail functionality
81
+
82
  = 1.0.8 =
83
 
84
  * Plugin now works with WordPress 3.9