WP SMTP - Version 1.1.10

Version Description

New maintainer - yehudah https://wpsmtpmail.com/v1-1-10-wp-smtp-is-back/

  • Code structure and organize.
  • Credentials can now be configured inside wp-config.php
Download this release

Release Info

Developer yehudah
Plugin Icon 128x128 WP SMTP
Version 1.1.10
Comparing to
See all releases

Code changes from version 1.1.9 to 1.1.10

Files changed (3) hide show
  1. readme.txt +32 -21
  2. wp-smtp.php +95 -57
  3. wp_smtp_admin.php +247 -267
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === WP SMTP ===
2
- Contributors: boliquan
3
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SCWY6NPFRR8EY
4
  Tags: wp smtp,smtp,mail,email,phpmailer,mailer,wp mail,gmail,yahoo,mail smtp,ssl,tls
5
  License: GPLv2
6
  Requires at least: 2.7
7
- Tested up to: 3.9.1
8
- Stable tag: 1.1.9
9
 
10
  WP SMTP can help us to send emails via SMTP instead of the PHP mail() function.
11
 
@@ -16,27 +16,30 @@ It adds a settings page to "Dashboard"->"Settings"->"WP SMTP" where you can conf
16
  There are some examples on the settings page, you can click the corresponding icon to view (such as "Gmail""Yahoo!""Microsoft""163""QQ").
17
  If the field "From" was not a valid email address, or the field "SMTP Host" was left blank, it will not reconfigure the wp_mail() function.
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  = Usage =
20
 
21
  1. Download and extract `wp-smtp.zip` to `wp-content/plugins/`
22
  2. Activate the plugin through the 'Plugins' menu in WordPress.
23
  3. "Dashboard"->"Settings"->"WP SMTP"
24
  4. There are some examples on the settings page, you can click the corresponding icon to view.(such as "Gmail""Yahoo!""Microsoft""163""QQ")
25
- 5. For more information of this plugin, please visit: [Plugin Homepage](http://boliquan.com/wp-smtp/ "WP SMTP").
26
-
27
- Related Links:
28
-
29
- * <a href="http://boliquan.com/wp-smtp/">WP SMTP (FAQ)</a> | <a href="http://wordpress.org/plugins/wp-smtp/">Download</a>
30
- * <a href="http://boliquan.com/wp-clean-up/">WP Clean Up</a> | <a href="http://wordpress.org/plugins/wp-clean-up/">Download</a>
31
- * <a href="http://boliquan.com/wp-anti-spam/">WP Anti Spam</a> | <a href="http://wordpress.org/plugins/wp-anti-spam/">Download</a>
32
- * <a href="http://boliquan.com/wp-code-highlight/">WP Code Highlight</a> | <a href="http://wordpress.org/plugins/wp-code-highlight/">Download</a>
33
- * <a href="http://boliquan.com/wp-slug-translate/">WP Slug Translate</a> | <a href="http://wordpress.org/plugins/wp-slug-translate/">Download</a>
34
- * <a href="http://boliquan.com/yg-share/">YG Share</a> | <a href="http://wordpress.org/plugins/yg-share/">Download</a>
35
- * <a href="http://boliquan.com/">BoLiQuan</a>
36
- * <a href="http://boliquan.com/">玻璃泉</a>
37
- * <a href="http://boliquan.com/">夜光</a>
38
- * <a href="http://boliquan.com/ylife/">YLife</a> | <a href="http://code.google.com/p/ylife/downloads/list">Download</a>
39
-
40
 
41
  == Installation ==
42
 
@@ -44,10 +47,18 @@ Related Links:
44
  2. Activate the plugin through the 'Plugins' menu in WordPress.
45
  3. "Dashboard"->"Settings"->"WP SMTP"
46
  4. There are some examples on the settings page, you can click the corresponding icon to view.(such as "Gmail""Yahoo!""Microsoft""163""QQ")
47
- 5. For more information of this plugin, please visit: [Plugin Homepage](http://boliquan.com/wp-smtp/ "WP SMTP").
48
 
49
  == Changelog ==
50
 
 
 
 
 
 
 
 
 
51
  = 1.1.9 =
52
 
53
  * Some optimization
@@ -90,7 +101,7 @@ Related Links:
90
 
91
  == Frequently Asked Questions ==
92
 
93
- You can sumbit it in http://boliquan.com/wp-smtp/
94
 
95
 
96
  == Upgrade Notice ==
1
  === WP SMTP ===
2
+ Contributors: yehudah
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=yehuda@myinbox.in&item_name=Donation+for+WPSMTP
4
  Tags: wp smtp,smtp,mail,email,phpmailer,mailer,wp mail,gmail,yahoo,mail smtp,ssl,tls
5
  License: GPLv2
6
  Requires at least: 2.7
7
+ Tested up to: 4.9.9
8
+ Stable tag: 1.1.10
9
 
10
  WP SMTP can help us to send emails via SMTP instead of the PHP mail() function.
11
 
16
  There are some examples on the settings page, you can click the corresponding icon to view (such as "Gmail""Yahoo!""Microsoft""163""QQ").
17
  If the field "From" was not a valid email address, or the field "SMTP Host" was left blank, it will not reconfigure the wp_mail() function.
18
 
19
+ = Do you want more advanced SMTP mailer? =
20
+
21
+ * Built-in **importer for WP SMTP settings**.
22
+ * Universal SMTP for every service.
23
+ * SMTP ports are blocked? API support - A method for sending emails via HTTP for Gmail, Sendgrid, Mailgun, and Mandrill.
24
+ * Credentials can be configured inside wp-config.php insted of the DB.
25
+ * Built-in mail logger with the option to resend and filter.
26
+ * Built-in alert function when emails are faling, you can get notified by Email, Slack or pushover.
27
+ * Ports checker for any blocking issue.
28
+
29
+ **Check Post SMTP:**
30
+ [https://wordpress.org/plugins/post-smtp/](https://wordpress.org/plugins/post-smtp/)
31
+
32
+ = CREDITS =
33
+
34
+ WP SMTP plugin was originally created by BoLiQuan. It is now owned and maintained by Yehuda Hassine.
35
+
36
  = Usage =
37
 
38
  1. Download and extract `wp-smtp.zip` to `wp-content/plugins/`
39
  2. Activate the plugin through the 'Plugins' menu in WordPress.
40
  3. "Dashboard"->"Settings"->"WP SMTP"
41
  4. There are some examples on the settings page, you can click the corresponding icon to view.(such as "Gmail""Yahoo!""Microsoft""163""QQ")
42
+ 5. For more information of this plugin, please visit: [Plugin Homepage](https://wpsmtpmail.com/ "WP SMTP").
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
  == Installation ==
45
 
47
  2. Activate the plugin through the 'Plugins' menu in WordPress.
48
  3. "Dashboard"->"Settings"->"WP SMTP"
49
  4. There are some examples on the settings page, you can click the corresponding icon to view.(such as "Gmail""Yahoo!""Microsoft""163""QQ")
50
+ 5. For more information of this plugin, please visit: [Plugin Homepage](https://wpsmtpmail.com/ "WP SMTP").
51
 
52
  == Changelog ==
53
 
54
+ = 1.1.10 =
55
+
56
+ New maintainer - yehudah
57
+ https://wpsmtpmail.com/v1-1-10-wp-smtp-is-back/
58
+
59
+ * Code structure and organize.
60
+ * Credentials can now be configured inside wp-config.php
61
+
62
  = 1.1.9 =
63
 
64
  * Some optimization
101
 
102
  == Frequently Asked Questions ==
103
 
104
+ You can sumbit it in https://wordpress.org/support/plugin/wp-smtp, if It's urgent like a bug submit it here: https://wpsmtpmail.com/contact/
105
 
106
 
107
  == Upgrade Notice ==
wp-smtp.php CHANGED
@@ -1,75 +1,113 @@
1
  <?php
 
 
2
  /*
3
  Plugin Name: WP SMTP
4
- Plugin URI: http://boliquan.com/wp-smtp/
5
  Description: WP SMTP can help us to send emails via SMTP instead of the PHP mail() function.
6
- Version: 1.1.9
7
- Author: BoLiQuan
8
- Author URI: http://boliquan.com/
9
- Text Domain: WP-SMTP
10
  Domain Path: /lang
 
 
11
  */
12
 
13
- function load_wp_smtp_lang(){
14
- $currentLocale = get_locale();
15
- if(!empty($currentLocale)){
16
- $moFile = dirname(__FILE__) . "/lang/wp-smtp-" . $currentLocale . ".mo";
17
- if(@file_exists($moFile) && is_readable($moFile)) { load_textdomain('WP-SMTP',$moFile); }
 
 
 
 
 
 
 
 
 
 
18
  }
19
- }
20
- add_filter('init','load_wp_smtp_lang');
21
 
22
- $wsOptions = get_option("wp_smtp_options");
 
 
23
 
24
- function wp_smtp($phpmailer){
25
- global $wsOptions;
26
- if( !is_email($wsOptions["from"]) || empty($wsOptions["host"]) ){
27
- return;
 
28
  }
29
- $phpmailer->Mailer = "smtp";
30
- $phpmailer->From = $wsOptions["from"];
31
- $phpmailer->FromName = $wsOptions["fromname"];
32
- $phpmailer->Sender = $phpmailer->From; //Return-Path
33
- $phpmailer->AddReplyTo($phpmailer->From,$phpmailer->FromName); //Reply-To
34
- $phpmailer->Host = $wsOptions["host"];
35
- $phpmailer->SMTPSecure = $wsOptions["smtpsecure"];
36
- $phpmailer->Port = $wsOptions["port"];
37
- $phpmailer->SMTPAuth = ($wsOptions["smtpauth"]=="yes") ? TRUE : FALSE;
38
- if($phpmailer->SMTPAuth){
39
- $phpmailer->Username = $wsOptions["username"];
40
- $phpmailer->Password = $wsOptions["password"];
 
 
41
  }
42
- }
43
- add_action('phpmailer_init','wp_smtp');
44
-
45
- function wp_smtp_activate(){
46
- $wsOptions = array();
47
- $wsOptions["from"] = "";
48
- $wsOptions["fromname"] = "";
49
- $wsOptions["host"] = "";
50
- $wsOptions["smtpsecure"] = "";
51
- $wsOptions["port"] = "";
52
- $wsOptions["smtpauth"] = "yes";
53
- $wsOptions["username"] = "";
54
- $wsOptions["password"] = "";
55
- $wsOptions["deactivate"] = "";
56
- add_option("wp_smtp_options",$wsOptions);
57
- }
58
- register_activation_hook( __FILE__ , 'wp_smtp_activate' );
59
 
60
- if($wsOptions["deactivate"]=="yes"){
61
- register_deactivation_hook( __FILE__ , create_function('','delete_option("wp_smtp_options");') );
62
- }
 
 
63
 
64
- function wp_smtp_settings_link($action_links,$plugin_file){
65
- if($plugin_file==plugin_basename(__FILE__)){
66
- $ws_settings_link = '<a href="options-general.php?page=' . dirname(plugin_basename(__FILE__)) . '/wp_smtp_admin.php">' . __("Settings") . '</a>';
67
- array_unshift($action_links,$ws_settings_link);
68
  }
69
- return $action_links;
70
- }
71
- add_filter('plugin_action_links','wp_smtp_settings_link',10,2);
72
 
73
- if(is_admin()){require_once('wp_smtp_admin.php');}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
 
75
  ?>
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
  /*
5
  Plugin Name: WP SMTP
 
6
  Description: WP SMTP can help us to send emails via SMTP instead of the PHP mail() function.
7
+ Version: 1.1.10
8
+ Author: Yehuda Hassine
9
+ Text Domain: wp-smtp
 
10
  Domain Path: /lang
11
+ License: GPLv2 or later
12
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
  */
14
 
15
+ /*
16
+ * The plugin was originally created by BoLiQuan
17
+ */
18
+
19
+ class WP_SMTP {
20
+
21
+ private $wsOptions, $phpmailer_error;
22
+
23
+ public function __construct() {
24
+ $this->setup_vars();
25
+ $this->hooks();
26
+ }
27
+
28
+ public function setup_vars(){
29
+ $this->wsOptions = get_option( 'wp_smtp_options' );
30
  }
 
 
31
 
32
+ public function hooks() {
33
+ register_activation_hook( __FILE__ , array( $this,'wp_smtp_activate' ) );
34
+ register_deactivation_hook( __FILE__, array( $this, 'wp_smtp_deactivate' ) );
35
 
36
+ add_filter( 'plugin_action_links', array( $this, 'wp_smtp_settings_link' ), 10, 2 );
37
+ add_action( 'init', array( $this,'load_textdomain' ) );
38
+ add_action( 'phpmailer_init', array( $this,'wp_smtp' ) );
39
+ add_action( 'wp_mail_failed', array( $this, 'catch_phpmailer_error' ) );
40
+ add_action( 'admin_menu', array( $this, 'wp_smtp_admin' ) );
41
  }
42
+
43
+ function wp_smtp_activate(){
44
+ $wsOptions = array();
45
+ $wsOptions["from"] = "";
46
+ $wsOptions["fromname"] = "";
47
+ $wsOptions["host"] = "";
48
+ $wsOptions["smtpsecure"] = "";
49
+ $wsOptions["port"] = "";
50
+ $wsOptions["smtpauth"] = "yes";
51
+ $wsOptions["username"] = "";
52
+ $wsOptions["password"] = "";
53
+ $wsOptions["deactivate"] = "";
54
+
55
+ add_option( 'wp_smtp_options', $wsOptions );
56
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
+ function wp_smtp_deactivate() {
59
+ if( $this->wsOptions['deactivate'] == 'yes' ) {
60
+ delete_option( 'wp_smtp_options' );
61
+ }
62
+ }
63
 
64
+ function load_textdomain() {
65
+ load_plugin_textdomain( 'wp-smtp', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );
 
 
66
  }
 
 
 
67
 
68
+ function wp_smtp( $phpmailer ) {
69
+
70
+ if( ! is_email($this->wsOptions["from"] ) || empty( $this->wsOptions["host"] ) ) {
71
+ return;
72
+ }
73
+
74
+ $phpmailer->Mailer = "smtp";
75
+ $phpmailer->From = $this->wsOptions["from"];
76
+ $phpmailer->FromName = $this->wsOptions["fromname"];
77
+ $phpmailer->Sender = $phpmailer->From; //Return-Path
78
+ $phpmailer->AddReplyTo($phpmailer->From,$phpmailer->FromName); //Reply-To
79
+ $phpmailer->Host = $this->wsOptions["host"];
80
+ $phpmailer->SMTPSecure = $this->wsOptions["smtpsecure"];
81
+ $phpmailer->Port = $this->wsOptions["port"];
82
+ $phpmailer->SMTPAuth = ($this->wsOptions["smtpauth"]=="yes") ? TRUE : FALSE;
83
+
84
+ if( $phpmailer->SMTPAuth ){
85
+ $phpmailer->Username = $this->wsOptions["username"];
86
+ $phpmailer->Password = $this->wsOptions["password"];
87
+ }
88
+ }
89
+
90
+ function catch_phpmailer_error( $error ) {
91
+ $this->phpmailer_error = $error;
92
+ }
93
+
94
+ function wp_smtp_settings_link($action_links,$plugin_file) {
95
+ if( $plugin_file == plugin_basename( __FILE__ ) ) {
96
+ $ws_settings_link = '<a href="options-general.php?page=' . dirname( plugin_basename(__FILE__) ) . '/wp-smtp.php">' . __("Settings") . '</a>';
97
+ array_unshift($action_links,$ws_settings_link);
98
+ }
99
+
100
+ return $action_links;
101
+ }
102
+
103
+ function wp_smtp_admin(){
104
+ add_options_page('WP SMTP Options', 'WP SMTP','manage_options', __FILE__, array( $this, 'wp_smtp_page') );
105
+ }
106
+
107
+ function wp_smtp_page(){
108
+ require_once __DIR__ . '/wp_smtp_admin.php';
109
+ }
110
+ }
111
 
112
+ new WP_SMTP();
113
  ?>
wp_smtp_admin.php CHANGED
@@ -1,279 +1,259 @@
1
  <?php
2
- function wp_smtp_admin(){
3
- add_options_page('WP SMTP Options', 'WP SMTP','manage_options', __FILE__, 'wp_smtp_page');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
5
 
6
- function wp_smtp_page(){
7
- $ws_nonce = wp_create_nonce('my_ws_nonce');
8
- global $wsOptions;
9
- if(isset($_POST['wp_smtp_update']) && isset($_POST['wp_smtp_nonce_update'])){
10
- if(!wp_verify_nonce(trim($_POST['wp_smtp_nonce_update']),'my_ws_nonce')){
11
- wp_die('Security check not passed!');
12
- }
13
- $wsOptions = array();
14
- $wsOptions["from"] = trim($_POST['wp_smtp_from']);
15
- $wsOptions["fromname"] = trim($_POST['wp_smtp_fromname']);
16
- $wsOptions["host"] = trim($_POST['wp_smtp_host']);
17
- $wsOptions["smtpsecure"] = trim($_POST['wp_smtp_smtpsecure']);
18
- $wsOptions["port"] = trim($_POST['wp_smtp_port']);
19
- $wsOptions["smtpauth"] = trim($_POST['wp_smtp_smtpauth']);
20
- $wsOptions["username"] = trim($_POST['wp_smtp_username']);
21
- $wsOptions["password"] = trim($_POST['wp_smtp_password']);
22
- $wsOptions["deactivate"] = (isset($_POST['wp_smtp_deactivate'])) ? trim($_POST['wp_smtp_deactivate']) : "";
23
- update_option("wp_smtp_options",$wsOptions);
24
- if(!is_email($wsOptions["from"])){
25
- echo '<div id="message" class="updated fade"><p><strong>' . __("The field \"From\" must be a valid email address!","WP-SMTP") . '</strong></p></div>';
26
- }
27
- elseif(empty($wsOptions["host"])){
28
- echo '<div id="message" class="updated fade"><p><strong>' . __("The field \"SMTP Host\" can not be left blank!","WP-SMTP") . '</strong></p></div>';
29
- }
30
- else{
31
- echo '<div id="message" class="updated fade"><p><strong>' . __("Options saved.","WP-SMTP") . '</strong></p></div>';
32
- }
33
- }
34
- if(isset($_POST['wp_smtp_test']) && isset($_POST['wp_smtp_nonce_test'])){
35
- if(!wp_verify_nonce(trim($_POST['wp_smtp_nonce_test']),'my_ws_nonce')){
36
- wp_die('Security check not passed!');
37
- }
38
- $to = trim($_POST['wp_smtp_to']);
39
- $subject = trim($_POST['wp_smtp_subject']);
40
- $message = trim($_POST['wp_smtp_message']);
41
- $failed = 0;
42
- if(!empty($to) && !empty($subject) && !empty($message)){
43
- try{
44
- $result = wp_mail($to,$subject,$message);
45
- }catch(phpmailerException $e){
46
- $failed = 1;
47
- }
48
- }
49
- else{
50
- $failed = 2;
51
- }
52
- if(!$failed){
53
- if($result==TRUE){
54
- echo '<div id="message" class="updated fade"><p><strong>' . __("Message sent!","WP-SMTP") . '</strong></p></div>';
55
- }
56
- else{
57
- $failed = 1;
58
- }
59
- }
60
- if($failed == 1){
61
- echo '<div id="message" class="updated fade"><p><strong>' . __("Some errors occurred!","WP-SMTP") . '</strong></p></div>';
62
- }
63
- elseif($failed == 2){
64
- echo '<div id="message" class="updated fade"><p><strong>' . __("The fields \"To\" \"Subject\" \"Message\" can not be left blank when testing!","WP-SMTP") . '</strong></p></div>';
65
- }
66
- }
67
- ?>
68
- <div class="wrap">
69
-
70
- <?php screen_icon(); ?>
71
- <h2>
72
- WP SMTP
73
- <span style="margin-left:10px; vertical-align:middle;">
74
- <a href="<?php echo plugins_url('screenshot-1.png',__FILE__); ?>" target="_blank"><img src="<?php echo plugins_url('/img/gmail.png',__FILE__); ?>" alt="Gmail" title="Gmail" /></a>
75
- <a href="<?php echo plugins_url('screenshot-2.png',__FILE__); ?>" target="_blank"><img src="<?php echo plugins_url('/img/yahoo.png',__FILE__); ?>" alt="Yahoo!" title="Yahoo!" /></a>
76
- <a href="<?php echo plugins_url('screenshot-3.png',__FILE__); ?>" target="_blank"><img src="<?php echo plugins_url('/img/microsoft.png',__FILE__); ?>" alt="Microsoft" title="Microsoft" /></a>
77
- <a href="<?php echo plugins_url('screenshot-4.png',__FILE__); ?>" target="_blank"><img src="<?php echo plugins_url('/img/163.png',__FILE__); ?>" alt="163" title="163" /></a>
78
- <a href="<?php echo plugins_url('screenshot-5.png',__FILE__); ?>" target="_blank"><img src="<?php echo plugins_url('/img/qq.png',__FILE__); ?>" alt="QQ" title="QQ" /></a>
79
- </span>
80
- </h2>
81
 
82
- <form action="" method="post" enctype="multipart/form-data" name="wp_smtp_form">
 
 
 
 
83
 
84
- <table class="form-table">
85
- <tr valign="top">
86
- <th scope="row">
87
- <?php _e('From','WP-SMTP'); ?>
88
- </th>
89
- <td>
90
- <label>
91
- <input type="text" name="wp_smtp_from" value="<?php echo $wsOptions["from"]; ?>" size="43" style="width:272px;height:24px;" />
92
- </label>
93
- </td>
94
- </tr>
95
- <tr valign="top">
96
- <th scope="row">
97
- <?php _e('From Name','WP-SMTP'); ?>
98
- </th>
99
- <td>
100
- <label>
101
- <input type="text" name="wp_smtp_fromname" value="<?php echo $wsOptions["fromname"]; ?>" size="43" style="width:272px;height:24px;" />
102
- </label>
103
- </td>
104
- </tr>
105
- <tr valign="top">
106
- <th scope="row">
107
- <?php _e('SMTP Host','WP-SMTP'); ?>
108
- </th>
109
- <td>
110
- <label>
111
- <input type="text" name="wp_smtp_host" value="<?php echo $wsOptions["host"]; ?>" size="43" style="width:272px;height:24px;" />
112
- </label>
113
- </td>
114
- </tr>
115
- <tr valign="top">
116
- <th scope="row">
117
- <?php _e('SMTP Secure','WP-SMTP'); ?>
118
- </th>
119
- <td>
120
- <label>
121
- <input name="wp_smtp_smtpsecure" type="radio" value=""<?php if ($wsOptions["smtpsecure"] == '') { ?> checked="checked"<?php } ?> />
122
- None
123
- </label>
124
- &nbsp;
125
- <label>
126
- <input name="wp_smtp_smtpsecure" type="radio" value="ssl"<?php if ($wsOptions["smtpsecure"] == 'ssl') { ?> checked="checked"<?php } ?> />
127
- SSL
128
- </label>
129
- &nbsp;
130
- <label>
131
- <input name="wp_smtp_smtpsecure" type="radio" value="tls"<?php if ($wsOptions["smtpsecure"] == 'tls') { ?> checked="checked"<?php } ?> />
132
- TLS
133
- </label>
134
- </td>
135
- </tr>
136
- <tr valign="top">
137
- <th scope="row">
138
- <?php _e('SMTP Port','WP-SMTP'); ?>
139
- </th>
140
- <td>
141
- <label>
142
- <input type="text" name="wp_smtp_port" value="<?php echo $wsOptions["port"]; ?>" size="43" style="width:272px;height:24px;" />
143
- </label>
144
- </td>
145
- </tr>
146
- <tr valign="top">
147
- <th scope="row">
148
- <?php _e('SMTP Authentication','WP-SMTP'); ?>
149
- </th>
150
- <td>
151
- <label>
152
- <input name="wp_smtp_smtpauth" type="radio" value="no"<?php if ($wsOptions["smtpauth"] == 'no') { ?> checked="checked"<?php } ?> />
153
- No
154
- </label>
155
- &nbsp;
156
- <label>
157
- <input name="wp_smtp_smtpauth" type="radio" value="yes"<?php if ($wsOptions["smtpauth"] == 'yes') { ?> checked="checked"<?php } ?> />
158
- Yes
159
- </label>
160
- </td>
161
- </tr>
162
- <tr valign="top">
163
- <th scope="row">
164
- <?php _e('Username','WP-SMTP'); ?>
165
- </th>
166
- <td>
167
- <label>
168
- <input type="text" name="wp_smtp_username" value="<?php echo $wsOptions["username"]; ?>" size="43" style="width:272px;height:24px;" />
169
- </label>
170
- </td>
171
- </tr>
172
- <tr valign="top">
173
- <th scope="row">
174
- <?php _e('Password','WP-SMTP'); ?>
175
- </th>
176
- <td>
177
- <label>
178
- <input type="password" name="wp_smtp_password" value="<?php echo $wsOptions["password"]; ?>" size="43" style="width:272px;height:24px;" />
179
- </label>
180
- </td>
181
- </tr>
182
- <tr valign="top">
183
- <th scope="row">
184
- <?php _e('Delete Options','WP-SMTP'); ?>
185
- </th>
186
- <td>
187
- <label>
188
- <input type="checkbox" name="wp_smtp_deactivate" value="yes" <?php if($wsOptions["deactivate"]=='yes') echo 'checked="checked"'; ?> />
189
- <?php _e('Delete options while deactivate this plugin.','WP-SMTP'); ?>
190
- </label>
191
- </td>
192
- </tr>
193
- </table>
194
 
195
- <p class="submit">
196
- <input type="hidden" name="wp_smtp_update" value="update" />
197
- <input type="hidden" name="wp_smtp_nonce_update" value="<?php echo $ws_nonce; ?>" />
198
- <input type="submit" class="button-primary" name="Submit" value="<?php _e('Save Changes'); ?>" />
199
- </p>
 
 
 
200
 
201
- </form>
 
 
 
 
 
202
 
203
- <form action="" method="post" enctype="multipart/form-data" name="wp_smtp_testform">
204
- <table class="form-table">
205
- <tr valign="top">
206
- <th scope="row">
207
- <?php _e('To:','WP-SMTP'); ?>
208
- </th>
209
- <td>
210
- <label>
211
- <input type="text" name="wp_smtp_to" value="" size="43" style="width:272px;height:24px;" />
212
- </label>
213
- </td>
214
- </tr>
215
- <tr valign="top">
216
- <th scope="row">
217
- <?php _e('Subject:','WP-SMTP'); ?>
218
- </th>
219
- <td>
220
- <label>
221
- <input type="text" name="wp_smtp_subject" value="" size="43" style="width:272px;height:24px;" />
222
- </label>
223
- </td>
224
- </tr>
225
- <tr valign="top">
226
- <th scope="row">
227
- <?php _e('Message:','WP-SMTP'); ?>
228
- </th>
229
- <td>
230
- <label>
231
- <textarea type="text" name="wp_smtp_message" value="" cols="45" rows="3" style="width:284px;height:62px;"></textarea>
232
- </label>
233
- </td>
234
- </tr>
235
- </table>
236
- <p class="submit">
237
- <input type="hidden" name="wp_smtp_test" value="test" />
238
- <input type="hidden" name="wp_smtp_nonce_test" value="<?php echo $ws_nonce; ?>" />
239
- <input type="submit" class="button-primary" value="<?php _e('Send Test','WP-SMTP'); ?>" />
240
- </p>
241
- </form>
242
 
243
- <br />
244
- <?php $donate_url = plugins_url('/img/paypal_32_32.jpg', __FILE__);?>
245
- <?php $paypal_donate_url = plugins_url('/img/paypal_donate_email.jpg', __FILE__);?>
246
- <?php $ali_donate_url = plugins_url('/img/alipay_donate_email.jpg', __FILE__);?>
247
- <div class="icon32"><img src="<?php echo $donate_url; ?>" alt="Donate" /></div>
248
- <h2>Donate</h2>
249
- <p>
250
- If you find my work useful and you want to encourage the development of more free resources, you can do it by donating.
251
- </p>
252
- <p>
253
- <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SCWY6NPFRR8EY" target="_blank"><img src="<?php echo $paypal_donate_url; ?>" alt="Paypal Donate" title="Paypal" /></a>
254
- &nbsp;
255
- <a href="https://www.alipay.com/" target="_blank"><img src="<?php echo $ali_donate_url; ?>" alt="Alipay Donate" title="Alipay" /></a>
256
- </p>
257
- <br />
258
 
259
- <?php $blq_logo_url = plugins_url('/img/blq_32_32.jpg', __FILE__);?>
260
- <div class="icon32"><img src="<?php echo $blq_logo_url; ?>" alt="BoLiQuan" /></div>
261
- <h2>Related Links</h2>
262
- <ul style="margin:0 18px;">
263
- <li><a href="http://boliquan.com/wp-smtp/" target="_blank">WP SMTP (FAQ)</a> | <a href="http://wordpress.org/plugins/wp-smtp/" target="_blank">Usage</a> | <a href="http://wordpress.org/plugins/wp-smtp/" target="_blank">Download</a></li>
264
- <li><a href="http://boliquan.com/wp-clean-up/" target="_blank">WP Clean Up</a> | <a href="http://wordpress.org/plugins/wp-clean-up/" target="_blank">Download</a></li>
265
- <li><a href="http://boliquan.com/wp-anti-spam/" target="_blank">WP Anti Spam</a> | <a href="http://wordpress.org/plugins/wp-anti-spam/" target="_blank">Download</a></li>
266
- <li><a href="http://boliquan.com/wp-code-highlight/" target="_blank">WP Code Highlight</a> | <a href="http://wordpress.org/plugins/wp-code-highlight/" target="_blank">Download</a></li>
267
- <li><a href="http://boliquan.com/wp-slug-translate/" target="_blank">WP Slug Translate</a> | <a href="http://wordpress.org/plugins/wp-slug-translate/" target="_blank">Download</a></li>
268
- <li><a href="http://boliquan.com/yg-share/" target="_blank">YG Share</a> | <a href="http://wordpress.org/plugins/yg-share/" target="_blank">Download</a></li>
269
- <li><a href="http://boliquan.com/ylife/" target="_blank">YLife</a> | <a href="http://code.google.com/p/ylife/downloads/list" target="_blank">Download</a></li>
270
- <li><a href="http://boliquan.com/" target="_blank">BoLiQuan</a></li>
271
- </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
 
273
- <div style="text-align:center; margin:60px 0 10px 0;">&copy; <?php echo date("Y"); ?> BoLiQuan.COM</div>
 
 
 
 
274
 
275
- </div>
276
- <?php
277
- }
278
- add_action('admin_menu', 'wp_smtp_admin');
279
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ // Catch the SMTP settings
5
+ if (isset($_POST['wp_smtp_update']) && isset($_POST['wp_smtp_nonce_update'])) {
6
+ if (!wp_verify_nonce(trim($_POST['wp_smtp_nonce_update']), 'my_ws_nonce')) {
7
+ wp_die('Security check not passed!');
8
+ }
9
+ $this->wsOptions = array();
10
+ $this->wsOptions["from"] = sanitize_email( trim( $_POST['wp_smtp_from'] ) );
11
+ $this->wsOptions["fromname"] = sanitize_text_field( trim( $_POST['wp_smtp_fromname'] ) );
12
+ $this->wsOptions["host"] = sanitize_text_field( trim( $_POST['wp_smtp_host'] ) );
13
+ $this->wsOptions["smtpsecure"] = sanitize_text_field( trim( $_POST['wp_smtp_smtpsecure'] ) );
14
+ $this->wsOptions["port"] = is_numeric( trim( $_POST['wp_smtp_port'] ) ) ? trim( $_POST['wp_smtp_port'] ) : '';
15
+ $this->wsOptions["smtpauth"] = sanitize_text_field( trim( $_POST['wp_smtp_smtpauth'] ) );
16
+ $this->wsOptions["username"] = defined( 'WP_SMTP_USER' ) ? WP_SMTP_USER : sanitize_text_field( trim( $_POST['wp_smtp_username'] ) );
17
+ $this->wsOptions["password"] = defined( 'WP_SMTP_PASS' ) ? WP_SMTP_PASS : sanitize_text_field( trim( $_POST['wp_smtp_password'] ) );
18
+ $this->wsOptions["deactivate"] = ( isset($_POST['wp_smtp_deactivate'] ) ) ? sanitize_text_field( trim( $_POST['wp_smtp_deactivate'] ) ) : '';
19
+
20
+ update_option("wp_smtp_options", $this->wsOptions);
21
+
22
+ if ( ! is_email($this->wsOptions["from"] ) ) {
23
+ echo '<div id="message" class="updated fade"><p><strong>' . __("The field \"From\" must be a valid email address!", "WP-SMTP") . '</strong></p></div>';
24
+ } elseif (empty($this->wsOptions["host"])) {
25
+ echo '<div id="message" class="updated fade"><p><strong>' . __("The field \"SMTP Host\" can not be left blank!", "WP-SMTP") . '</strong></p></div>';
26
+ } else {
27
+ echo '<div id="message" class="updated fade"><p><strong>' . __("Options saved.", "WP-SMTP") . '</strong></p></div>';
28
+ }
29
  }
30
 
31
+ // Catch the test form
32
+ if ( isset( $_POST['wp_smtp_test'] ) && isset( $_POST['wp_smtp_nonce_test'] ) ) {
33
+
34
+ if ( ! wp_verify_nonce( trim( $_POST['wp_smtp_nonce_test'] ), 'my_ws_nonce' ) ) {
35
+ wp_die('Security check not passed!');
36
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
+ $to = sanitize_text_field( trim( $_POST['wp_smtp_to'] ) );
39
+ $subject = sanitize_text_field( trim( $_POST['wp_smtp_subject'] ) );
40
+ $message = sanitize_textarea_field(trim( $_POST['wp_smtp_message'] ) );
41
+ $status = false;
42
+ $class = 'error';
43
 
44
+ if ( ! empty( $to ) && is_email( $to ) && ! empty( $subject ) && ! empty( $message ) ) {
45
+ try {
46
+ $result = wp_mail( $to, $subject, $message );
47
+ } catch (Exception $e) {
48
+ $status = $e->getMessage();
49
+ }
50
+ } else {
51
+ $status = __( 'Some of the test fields are empty or an invalid email supplied', 'wp-smtp' );
52
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
+ if ( ! $status ) {
55
+ if ( $result === true ) {
56
+ $status = __( 'Message sent!', 'wp-smtp' );
57
+ $class = 'success';
58
+ } else {
59
+ $status = $this->phpmailer_error->get_error_message();
60
+ }
61
+ }
62
 
63
+ echo '<div id="message" class="notice notice-' . $class . ' is-dismissible"><p><strong>' . $status . '</strong></p></div>';
64
+ }
65
+
66
+ $ws_nonce = wp_create_nonce('my_ws_nonce');
67
+ ?>
68
+ <div class="wrap">
69
 
70
+ <h1>
71
+ WP SMTP
72
+ <span style="margin-left:10px; vertical-align:middle;">
73
+ <a href="<?php echo plugins_url('screenshot-1.png', __FILE__); ?>" target="_blank"><img
74
+ src="<?php echo plugins_url('/img/gmail.png', __FILE__); ?>" alt="Gmail" title="Gmail"/></a>
75
+ <a href="<?php echo plugins_url('screenshot-2.png', __FILE__); ?>" target="_blank"><img
76
+ src="<?php echo plugins_url('/img/yahoo.png', __FILE__); ?>" alt="Yahoo!" title="Yahoo!"/></a>
77
+ <a href="<?php echo plugins_url('screenshot-3.png', __FILE__); ?>" target="_blank"><img
78
+ src="<?php echo plugins_url('/img/microsoft.png', __FILE__); ?>" alt="Microsoft" title="Microsoft"/></a>
79
+ <a href="<?php echo plugins_url('screenshot-4.png', __FILE__); ?>" target="_blank"><img
80
+ src="<?php echo plugins_url('/img/163.png', __FILE__); ?>" alt="163" title="163"/></a>
81
+ <a href="<?php echo plugins_url('screenshot-5.png', __FILE__); ?>" target="_blank"><img
82
+ src="<?php echo plugins_url('/img/qq.png', __FILE__); ?>" alt="QQ" title="QQ"/></a>
83
+ </span>
84
+ </h1>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
+ <form action="" method="post" enctype="multipart/form-data" name="wp_smtp_form">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
88
+ <table class="form-table">
89
+ <tr valign="top">
90
+ <th scope="row">
91
+ <?php _e('From', 'wp-smtp'); ?>
92
+ </th>
93
+ <td>
94
+ <label>
95
+ <input type="email" name="wp_smtp_from" value="<?php echo $this->wsOptions["from"]; ?>" size="43"
96
+ style="width:272px;height:24px;" required/>
97
+ </label>
98
+ </td>
99
+ </tr>
100
+ <tr valign="top">
101
+ <th scope="row">
102
+ <?php _e('From Name', 'wp-smtp'); ?>
103
+ </th>
104
+ <td>
105
+ <label>
106
+ <input type="text" name="wp_smtp_fromname" value="<?php echo $this->wsOptions["fromname"]; ?>"
107
+ size="43" style="width:272px;height:24px;" required />
108
+ </label>
109
+ </td>
110
+ </tr>
111
+ <tr valign="top">
112
+ <th scope="row">
113
+ <?php _e('SMTP Host', 'wp-smtp'); ?>
114
+ </th>
115
+ <td>
116
+ <label>
117
+ <input type="text" name="wp_smtp_host" value="<?php echo $this->wsOptions["host"]; ?>" size="43"
118
+ style="width:272px;height:24px;" required />
119
+ </label>
120
+ </td>
121
+ </tr>
122
+ <tr valign="top">
123
+ <th scope="row">
124
+ <?php _e('SMTP Secure', 'wp-smtp'); ?>
125
+ </th>
126
+ <td>
127
+ <label>
128
+ <input name="wp_smtp_smtpsecure" type="radio"
129
+ value=""<?php if ($this->wsOptions["smtpsecure"] == '') { ?> checked="checked"<?php } ?> />
130
+ None
131
+ </label>
132
+ &nbsp;
133
+ <label>
134
+ <input name="wp_smtp_smtpsecure" type="radio"
135
+ value="ssl"<?php if ($this->wsOptions["smtpsecure"] == 'ssl') { ?> checked="checked"<?php } ?> />
136
+ SSL
137
+ </label>
138
+ &nbsp;
139
+ <label>
140
+ <input name="wp_smtp_smtpsecure" type="radio"
141
+ value="tls"<?php if ($this->wsOptions["smtpsecure"] == 'tls') { ?> checked="checked"<?php } ?> />
142
+ TLS
143
+ </label>
144
+ </td>
145
+ </tr>
146
+ <tr valign="top">
147
+ <th scope="row">
148
+ <?php _e('SMTP Port', 'wp-smtp'); ?>
149
+ </th>
150
+ <td>
151
+ <label>
152
+ <input type="text" name="wp_smtp_port" value="<?php echo $this->wsOptions["port"]; ?>" size="43"
153
+ style="width:272px;height:24px;"/>
154
+ </label>
155
+ </td>
156
+ </tr>
157
+ <tr valign="top">
158
+ <th scope="row">
159
+ <?php _e('SMTP Authentication', 'wp-smtp'); ?>
160
+ </th>
161
+ <td>
162
+ <label>
163
+ <input name="wp_smtp_smtpauth" type="radio"
164
+ value="no"<?php if ($this->wsOptions["smtpauth"] == 'no') { ?> checked="checked"<?php } ?> />
165
+ No
166
+ </label>
167
+ &nbsp;
168
+ <label>
169
+ <input name="wp_smtp_smtpauth" type="radio"
170
+ value="yes"<?php if ($this->wsOptions["smtpauth"] == 'yes') { ?> checked="checked"<?php } ?> />
171
+ Yes
172
+ </label>
173
+ </td>
174
+ </tr>
175
+ <tr valign="top">
176
+ <th scope="row">
177
+ <?php _e('Username', 'wp-smtp'); ?>
178
+ </th>
179
+ <td>
180
+ <label>
181
+ <input type="text" name="wp_smtp_username" value="<?php echo $this->wsOptions["username"]; ?>"
182
+ size="43" style="width:272px;height:24px;"/>
183
+ </label>
184
+ </td>
185
+ </tr>
186
+ <tr valign="top">
187
+ <th scope="row">
188
+ <?php _e('Password', 'wp-smtp'); ?>
189
+ </th>
190
+ <td>
191
+ <label>
192
+ <input type="password" name="wp_smtp_password" value="<?php echo $this->wsOptions["password"]; ?>"
193
+ size="43" style="width:272px;height:24px;"/>
194
+ </label>
195
+ </td>
196
+ </tr>
197
+ <tr valign="top">
198
+ <th scope="row">
199
+ <?php _e('Delete Options', 'wp-smtp'); ?>
200
+ </th>
201
+ <td>
202
+ <label>
203
+ <input type="checkbox" name="wp_smtp_deactivate"
204
+ value="yes" <?php if ($this->wsOptions["deactivate"] == 'yes') echo 'checked="checked"'; ?> />
205
+ <?php _e('Delete options while deactivate this plugin.', 'wp-smtp'); ?>
206
+ </label>
207
+ </td>
208
+ </tr>
209
+ </table>
210
 
211
+ <p class="submit">
212
+ <input type="hidden" name="wp_smtp_update" value="update"/>
213
+ <input type="hidden" name="wp_smtp_nonce_update" value="<?php echo $ws_nonce; ?>"/>
214
+ <input type="submit" class="button-primary" name="Submit" value="<?php _e('Save Changes'); ?>"/>
215
+ </p>
216
 
217
+ </form>
218
+
219
+ <form action="" method="post" enctype="multipart/form-data" name="wp_smtp_testform">
220
+ <h2><?php _e( 'Test your settings', 'wp-smtp' ); ?></h2>
221
+ <table class="form-table">
222
+ <tr valign="top">
223
+ <th scope="row">
224
+ <?php _e('To:', 'wp-smtp'); ?>
225
+ </th>
226
+ <td>
227
+ <label>
228
+ <input type="email" name="wp_smtp_to" value="" size="43" style="width:272px;height:24px;" required />
229
+ </label>
230
+ </td>
231
+ </tr>
232
+ <tr valign="top">
233
+ <th scope="row">
234
+ <?php _e('Subject:', 'wp-smtp'); ?>
235
+ </th>
236
+ <td>
237
+ <label>
238
+ <input type="text" name="wp_smtp_subject" value="" size="43" style="width:272px;height:24px;" required />
239
+ </label>
240
+ </td>
241
+ </tr>
242
+ <tr valign="top">
243
+ <th scope="row">
244
+ <?php _e('Message:', 'wp-smtp'); ?>
245
+ </th>
246
+ <td>
247
+ <label>
248
+ <textarea type="text" name="wp_smtp_message" value="" cols="45" rows="3"
249
+ style="width:284px;height:62px;" required></textarea>
250
+ </label>
251
+ </td>
252
+ </tr>
253
+ </table>
254
+ <p class="submit">
255
+ <input type="hidden" name="wp_smtp_test" value="test"/>
256
+ <input type="hidden" name="wp_smtp_nonce_test" value="<?php echo $ws_nonce; ?>"/>
257
+ <input type="submit" class="button-primary" value="<?php _e('Send Test', 'wp-smtp'); ?>"/>
258
+ </p>
259
+ </form>