Version Description
- Plugin will display an error message if log file is not writeable when "Clear Log" is clicked.
- Actual SMTP password is replaced by a gag on the settings page.
- Fixed minor bug in Reply-To option handling (thanks to arildur).
- Some improvements in developers-related options (thanks to erikmolenaar).
Download this release
Release Info
| Developer | mra13 |
| Plugin | |
| Version | 1.3.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.2.9 to 1.3.0
- easy-wp-smtp-admin-menu.php +18 -7
- easy-wp-smtp.php +31 -14
- readme.txt +7 -1
easy-wp-smtp-admin-menu.php
CHANGED
|
@@ -22,6 +22,7 @@ function swpsmtp_settings() {
|
|
| 22 |
|
| 23 |
$swpsmtp_options = get_option('swpsmtp_options');
|
| 24 |
$smtp_test_mail = get_option('smtp_test_mail');
|
|
|
|
| 25 |
if (empty($smtp_test_mail)) {
|
| 26 |
$smtp_test_mail = array('swpsmtp_to' => '', 'swpsmtp_subject' => '', 'swpsmtp_message' => '',);
|
| 27 |
}
|
|
@@ -48,11 +49,17 @@ function swpsmtp_settings() {
|
|
| 48 |
$swpsmtp_options['smtp_settings']['type_encryption'] = ( isset($_POST['swpsmtp_smtp_type_encryption']) ) ? sanitize_text_field($_POST['swpsmtp_smtp_type_encryption']) : 'none';
|
| 49 |
$swpsmtp_options['smtp_settings']['autentication'] = ( isset($_POST['swpsmtp_smtp_autentication']) ) ? sanitize_text_field($_POST['swpsmtp_smtp_autentication']) : 'yes';
|
| 50 |
$swpsmtp_options['smtp_settings']['username'] = sanitize_text_field($_POST['swpsmtp_smtp_username']);
|
| 51 |
-
$smtp_password =
|
| 52 |
-
$
|
|
|
|
|
|
|
| 53 |
$swpsmtp_options['smtp_settings']['enable_debug'] = isset($_POST['swpsmtp_enable_debug']) ? 1 : false;
|
| 54 |
$swpsmtp_options['enable_domain_check'] = isset($_POST['swpsmtp_enable_domain_check']) ? 1 : false;
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
/* Check value from "SMTP port" option */
|
| 58 |
if (isset($_POST['swpsmtp_smtp_port'])) {
|
|
@@ -182,7 +189,7 @@ function swpsmtp_settings() {
|
|
| 182 |
<tr class="ad_opt swpsmtp_smtp_options">
|
| 183 |
<th><?php _e('SMTP Password', 'easy-wp-smtp'); ?></th>
|
| 184 |
<td>
|
| 185 |
-
<input type='password' name='swpsmtp_smtp_password' value='<?php echo
|
| 186 |
<p class="description"><?php _e("The password to login to your mail server", 'easy-wp-smtp'); ?></p>
|
| 187 |
</td>
|
| 188 |
</tr>
|
|
@@ -210,7 +217,7 @@ function swpsmtp_settings() {
|
|
| 210 |
<td>
|
| 211 |
<input type="checkbox" id="swpsmtp_enable_domain_check" name="swpsmtp_enable_domain_check" value="1"<?php echo (isset($swpsmtp_options['enable_domain_check']) && ($swpsmtp_options['enable_domain_check'])) ? ' checked' : ''; ?>/>
|
| 212 |
<p class="description"><?php _e("This option is usually used by developers only. SMTP settings will be used only if the site is running on following domain(s):", 'easy-wp-smtp'); ?></p>
|
| 213 |
-
<input type="text" name="swpsmtp_allowed_domains" value="<?php echo $swpsmtp_options['allowed_domains']; ?>"<?php echo (isset($swpsmtp_options['enable_domain_check']) && ($swpsmtp_options['enable_domain_check'])) ? '' : ' disabled'; ?>/>
|
| 214 |
<p class="description"><?php _e("Coma-separated domains list. Example: domain1.com, domain2.com", 'easy-wp-smtp'); ?></p>
|
| 215 |
</td>
|
| 216 |
</tr>
|
|
@@ -245,6 +252,8 @@ function swpsmtp_settings() {
|
|
| 245 |
req.done(function (data) {
|
| 246 |
if (data === '1') {
|
| 247 |
alert("<?php _e('Log cleared.', 'easy-wp-smtp'); ?>");
|
|
|
|
|
|
|
| 248 |
}
|
| 249 |
});
|
| 250 |
}
|
|
@@ -297,7 +306,7 @@ function swpsmtp_settings() {
|
|
| 297 |
<div class="swpsmtp-yellow-box">
|
| 298 |
Visit the <a target="_blank" href="https://wp-ecommerce.net/easy-wordpress-smtp-send-emails-from-your-wordpress-site-using-a-smtp-server-2197">Easy WP SMTP</a> plugin's documentation page to learn how to use this plugin.
|
| 299 |
</div>
|
| 300 |
-
|
| 301 |
<?php
|
| 302 |
echo '</div></div>'; //<!-- end of #poststuff and #post-body -->
|
| 303 |
echo '</div>'; //<!-- end of .wrap #swpsmtp-mail .swpsmtp-mail -->
|
|
@@ -322,7 +331,9 @@ function swpsmtp_admin_init() {
|
|
| 322 |
$swpsmtp_options = get_option('swpsmtp_options');
|
| 323 |
$log_file_name = $swpsmtp_options['smtp_settings']['log_file_name'];
|
| 324 |
if (!file_exists(plugin_dir_path(__FILE__) . $log_file_name)) {
|
| 325 |
-
swpsmtp_write_to_log("Easy WP SMTP debug log file\r\n\r\n")
|
|
|
|
|
|
|
| 326 |
}
|
| 327 |
$logfile = fopen(plugin_dir_path(__FILE__) . $log_file_name, 'rb');
|
| 328 |
if (!$logfile) {
|
| 22 |
|
| 23 |
$swpsmtp_options = get_option('swpsmtp_options');
|
| 24 |
$smtp_test_mail = get_option('smtp_test_mail');
|
| 25 |
+
$gag_password = '#easywpsmtpgagpass#';
|
| 26 |
if (empty($smtp_test_mail)) {
|
| 27 |
$smtp_test_mail = array('swpsmtp_to' => '', 'swpsmtp_subject' => '', 'swpsmtp_message' => '',);
|
| 28 |
}
|
| 49 |
$swpsmtp_options['smtp_settings']['type_encryption'] = ( isset($_POST['swpsmtp_smtp_type_encryption']) ) ? sanitize_text_field($_POST['swpsmtp_smtp_type_encryption']) : 'none';
|
| 50 |
$swpsmtp_options['smtp_settings']['autentication'] = ( isset($_POST['swpsmtp_smtp_autentication']) ) ? sanitize_text_field($_POST['swpsmtp_smtp_autentication']) : 'yes';
|
| 51 |
$swpsmtp_options['smtp_settings']['username'] = sanitize_text_field($_POST['swpsmtp_smtp_username']);
|
| 52 |
+
$smtp_password = $_POST['swpsmtp_smtp_password'];
|
| 53 |
+
if ($smtp_password !== $gag_password) {
|
| 54 |
+
$swpsmtp_options['smtp_settings']['password'] = base64_encode($smtp_password);
|
| 55 |
+
}
|
| 56 |
$swpsmtp_options['smtp_settings']['enable_debug'] = isset($_POST['swpsmtp_enable_debug']) ? 1 : false;
|
| 57 |
$swpsmtp_options['enable_domain_check'] = isset($_POST['swpsmtp_enable_domain_check']) ? 1 : false;
|
| 58 |
+
if (isset($_POST['swpsmtp_allowed_domains'])) {
|
| 59 |
+
$swpsmtp_options['allowed_domains'] = base64_encode(sanitize_text_field($_POST['swpsmtp_allowed_domains']));
|
| 60 |
+
} else if (!isset($swpsmtp_options['allowed_domains'])) {
|
| 61 |
+
$swpsmtp_options['allowed_domains'] = '';
|
| 62 |
+
}
|
| 63 |
|
| 64 |
/* Check value from "SMTP port" option */
|
| 65 |
if (isset($_POST['swpsmtp_smtp_port'])) {
|
| 189 |
<tr class="ad_opt swpsmtp_smtp_options">
|
| 190 |
<th><?php _e('SMTP Password', 'easy-wp-smtp'); ?></th>
|
| 191 |
<td>
|
| 192 |
+
<input type='password' name='swpsmtp_smtp_password' value='<?php echo (swpsmtp_get_password() !== '' ? $gag_password : ''); ?>' /><br />
|
| 193 |
<p class="description"><?php _e("The password to login to your mail server", 'easy-wp-smtp'); ?></p>
|
| 194 |
</td>
|
| 195 |
</tr>
|
| 217 |
<td>
|
| 218 |
<input type="checkbox" id="swpsmtp_enable_domain_check" name="swpsmtp_enable_domain_check" value="1"<?php echo (isset($swpsmtp_options['enable_domain_check']) && ($swpsmtp_options['enable_domain_check'])) ? ' checked' : ''; ?>/>
|
| 219 |
<p class="description"><?php _e("This option is usually used by developers only. SMTP settings will be used only if the site is running on following domain(s):", 'easy-wp-smtp'); ?></p>
|
| 220 |
+
<input type="text" name="swpsmtp_allowed_domains" value="<?php echo base64_decode_maybe($swpsmtp_options['allowed_domains']); ?>"<?php echo (isset($swpsmtp_options['enable_domain_check']) && ($swpsmtp_options['enable_domain_check'])) ? '' : ' disabled'; ?>/>
|
| 221 |
<p class="description"><?php _e("Coma-separated domains list. Example: domain1.com, domain2.com", 'easy-wp-smtp'); ?></p>
|
| 222 |
</td>
|
| 223 |
</tr>
|
| 252 |
req.done(function (data) {
|
| 253 |
if (data === '1') {
|
| 254 |
alert("<?php _e('Log cleared.', 'easy-wp-smtp'); ?>");
|
| 255 |
+
} else {
|
| 256 |
+
alert("Error occured: " + data);
|
| 257 |
}
|
| 258 |
});
|
| 259 |
}
|
| 306 |
<div class="swpsmtp-yellow-box">
|
| 307 |
Visit the <a target="_blank" href="https://wp-ecommerce.net/easy-wordpress-smtp-send-emails-from-your-wordpress-site-using-a-smtp-server-2197">Easy WP SMTP</a> plugin's documentation page to learn how to use this plugin.
|
| 308 |
</div>
|
| 309 |
+
|
| 310 |
<?php
|
| 311 |
echo '</div></div>'; //<!-- end of #poststuff and #post-body -->
|
| 312 |
echo '</div>'; //<!-- end of .wrap #swpsmtp-mail .swpsmtp-mail -->
|
| 331 |
$swpsmtp_options = get_option('swpsmtp_options');
|
| 332 |
$log_file_name = $swpsmtp_options['smtp_settings']['log_file_name'];
|
| 333 |
if (!file_exists(plugin_dir_path(__FILE__) . $log_file_name)) {
|
| 334 |
+
if (swpsmtp_write_to_log("Easy WP SMTP debug log file\r\n\r\n") === false) {
|
| 335 |
+
wp_die('Can\'t write to log file. Check if plugin directory (' . plugin_dir_path(__FILE__) . ') is writeable.');
|
| 336 |
+
};
|
| 337 |
}
|
| 338 |
$logfile = fopen(plugin_dir_path(__FILE__) . $log_file_name, 'rb');
|
| 339 |
if (!$logfile) {
|
easy-wp-smtp.php
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
Plugin Name: Easy WP SMTP
|
| 4 |
-
Version: 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/
|
|
@@ -82,9 +82,12 @@ if (!function_exists('swpsmtp_admin_head')) {
|
|
| 82 |
}
|
| 83 |
|
| 84 |
function swpsmtp_clear_log() {
|
| 85 |
-
swpsmtp_write_to_log("Easy WP SMTP debug log file\r\n\r\n", true)
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
| 88 |
}
|
| 89 |
|
| 90 |
function swpsmtp_write_to_log($str, $overwrite = false) {
|
|
@@ -94,12 +97,18 @@ function swpsmtp_write_to_log($str, $overwrite = false) {
|
|
| 94 |
} else {
|
| 95 |
// let's generate log file name
|
| 96 |
$log_file_name = uniqid() . '_debug_log.txt';
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
}
|
| 102 |
-
|
| 103 |
}
|
| 104 |
|
| 105 |
/**
|
|
@@ -118,12 +127,13 @@ if (!function_exists('swpsmtp_init_smtp')) {
|
|
| 118 |
if (isset($swpsmtp_options['enable_domain_check']) && $swpsmtp_options['enable_domain_check']) {
|
| 119 |
//check if allowed domains list is not blank
|
| 120 |
if (isset($swpsmtp_options['allowed_domains']) && !empty($swpsmtp_options['allowed_domains'])) {
|
|
|
|
| 121 |
//let's see if we have one domain or coma-separated domains
|
| 122 |
$domains_arr = explode(',', $swpsmtp_options['allowed_domains']);
|
| 123 |
if (is_array($domains_arr) && !empty($domains_arr)) {
|
| 124 |
//we have coma-separated list
|
| 125 |
} else {
|
| 126 |
-
//it's
|
| 127 |
unset($domains_arr);
|
| 128 |
$domains_arr = array($swpsmtp_options['allowed_domains']);
|
| 129 |
}
|
|
@@ -146,20 +156,20 @@ if (!function_exists('swpsmtp_init_smtp')) {
|
|
| 146 |
}
|
| 147 |
/* Set the mailer type as per config above, this overrides the already called isMail method */
|
| 148 |
$phpmailer->IsSMTP();
|
|
|
|
|
|
|
| 149 |
//set ReplyTo option if needed
|
| 150 |
//this should be set before SetFrom, otherwise might be ignored
|
| 151 |
if (!empty($swpsmtp_options['reply_to_email'])) {
|
| 152 |
$phpmailer->AddReplyTo($swpsmtp_options['reply_to_email'], $from_name);
|
| 153 |
}
|
| 154 |
-
$from_name = $swpsmtp_options['from_name_field'];
|
| 155 |
-
$from_email = $swpsmtp_options['from_email_field'];
|
| 156 |
// let's see if we have email ignore list populated
|
| 157 |
if (isset($swpsmtp_options['email_ignore_list']) && !empty($swpsmtp_options['email_ignore_list'])) {
|
| 158 |
$emails_arr = explode(',', $swpsmtp_options['email_ignore_list']);
|
| 159 |
if (is_array($emails_arr) && !empty($emails_arr)) {
|
| 160 |
//we have coma-separated list
|
| 161 |
} else {
|
| 162 |
-
//it's
|
| 163 |
unset($emails_arr);
|
| 164 |
$emails_arr = array($swpsmtp_options['email_ignore_list']);
|
| 165 |
}
|
|
@@ -365,9 +375,16 @@ function swpsmtp_activate() {
|
|
| 365 |
if (!isset($swpsmtp_options['allowed_domains'])) {
|
| 366 |
$domain = parse_url(get_site_url(), PHP_URL_HOST);
|
| 367 |
if ($domain) {
|
| 368 |
-
$swpsmtp_options['allowed_domains'] = $domain;
|
| 369 |
update_option('swpsmtp_options', $swpsmtp_options);
|
| 370 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 371 |
}
|
| 372 |
}
|
| 373 |
|
| 1 |
<?php
|
| 2 |
/*
|
| 3 |
Plugin Name: Easy WP SMTP
|
| 4 |
+
Version: 1.3.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/
|
| 82 |
}
|
| 83 |
|
| 84 |
function swpsmtp_clear_log() {
|
| 85 |
+
if (swpsmtp_write_to_log("Easy WP SMTP debug log file\r\n\r\n", true) !== false) {
|
| 86 |
+
echo '1';
|
| 87 |
+
} else {
|
| 88 |
+
echo 'Can\'t clear log - log file is not writeable.';
|
| 89 |
+
}
|
| 90 |
+
wp_die();
|
| 91 |
}
|
| 92 |
|
| 93 |
function swpsmtp_write_to_log($str, $overwrite = false) {
|
| 97 |
} else {
|
| 98 |
// let's generate log file name
|
| 99 |
$log_file_name = uniqid() . '_debug_log.txt';
|
| 100 |
+
$swpsmtp_options['smtp_settings']['log_file_name'] = $log_file_name;
|
| 101 |
+
update_option('swpsmtp_options', $swpsmtp_options);
|
| 102 |
+
file_put_contents(plugin_dir_path(__FILE__) . $log_file_name, "Easy WP SMTP debug log file\r\n\r\n");
|
| 103 |
+
}
|
| 104 |
+
return(file_put_contents(plugin_dir_path(__FILE__) . $log_file_name, $str, (!$overwrite ? FILE_APPEND : 0)));
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
function base64_decode_maybe($str) {
|
| 108 |
+
if (mb_detect_encoding($str) === mb_detect_encoding(base64_decode(base64_encode(base64_decode($str))))) {
|
| 109 |
+
$str = base64_decode($str);
|
| 110 |
}
|
| 111 |
+
return $str;
|
| 112 |
}
|
| 113 |
|
| 114 |
/**
|
| 127 |
if (isset($swpsmtp_options['enable_domain_check']) && $swpsmtp_options['enable_domain_check']) {
|
| 128 |
//check if allowed domains list is not blank
|
| 129 |
if (isset($swpsmtp_options['allowed_domains']) && !empty($swpsmtp_options['allowed_domains'])) {
|
| 130 |
+
$swpsmtp_options['allowed_domains'] = base64_decode_maybe($swpsmtp_options['allowed_domains']);
|
| 131 |
//let's see if we have one domain or coma-separated domains
|
| 132 |
$domains_arr = explode(',', $swpsmtp_options['allowed_domains']);
|
| 133 |
if (is_array($domains_arr) && !empty($domains_arr)) {
|
| 134 |
//we have coma-separated list
|
| 135 |
} else {
|
| 136 |
+
//it's single domain
|
| 137 |
unset($domains_arr);
|
| 138 |
$domains_arr = array($swpsmtp_options['allowed_domains']);
|
| 139 |
}
|
| 156 |
}
|
| 157 |
/* Set the mailer type as per config above, this overrides the already called isMail method */
|
| 158 |
$phpmailer->IsSMTP();
|
| 159 |
+
$from_name = $swpsmtp_options['from_name_field'];
|
| 160 |
+
$from_email = $swpsmtp_options['from_email_field'];
|
| 161 |
//set ReplyTo option if needed
|
| 162 |
//this should be set before SetFrom, otherwise might be ignored
|
| 163 |
if (!empty($swpsmtp_options['reply_to_email'])) {
|
| 164 |
$phpmailer->AddReplyTo($swpsmtp_options['reply_to_email'], $from_name);
|
| 165 |
}
|
|
|
|
|
|
|
| 166 |
// let's see if we have email ignore list populated
|
| 167 |
if (isset($swpsmtp_options['email_ignore_list']) && !empty($swpsmtp_options['email_ignore_list'])) {
|
| 168 |
$emails_arr = explode(',', $swpsmtp_options['email_ignore_list']);
|
| 169 |
if (is_array($emails_arr) && !empty($emails_arr)) {
|
| 170 |
//we have coma-separated list
|
| 171 |
} else {
|
| 172 |
+
//it's single email
|
| 173 |
unset($emails_arr);
|
| 174 |
$emails_arr = array($swpsmtp_options['email_ignore_list']);
|
| 175 |
}
|
| 375 |
if (!isset($swpsmtp_options['allowed_domains'])) {
|
| 376 |
$domain = parse_url(get_site_url(), PHP_URL_HOST);
|
| 377 |
if ($domain) {
|
| 378 |
+
$swpsmtp_options['allowed_domains'] = base64_encode($domain);
|
| 379 |
update_option('swpsmtp_options', $swpsmtp_options);
|
| 380 |
}
|
| 381 |
+
} else { // let's check if existing value should be base64 encoded
|
| 382 |
+
if (!empty($swpsmtp_options['allowed_domains'])) {
|
| 383 |
+
if (base64_decode_maybe($swpsmtp_options['allowed_domains']) === $swpsmtp_options['allowed_domains']) {
|
| 384 |
+
$swpsmtp_options['allowed_domains'] = base64_encode($swpsmtp_options['allowed_domains']);
|
| 385 |
+
update_option('swpsmtp_options', $swpsmtp_options);
|
| 386 |
+
}
|
| 387 |
+
}
|
| 388 |
}
|
| 389 |
}
|
| 390 |
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Donate link: https://wp-ecommerce.net/easy-wordpress-smtp-send-emails-from-your-
|
|
| 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.8
|
| 7 |
-
Stable tag: 1.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -77,6 +77,12 @@ Inspired by [WP Mail SMTP](http://wordpress.org/plugins/wp-mail-smtp/) plugin
|
|
| 77 |
|
| 78 |
== Changelog ==
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
= 1.2.9 =
|
| 81 |
* Added additional setting option to deal with email aliases (thanks to bradclarke365).
|
| 82 |
* Fixed "Reply-To" option wasn't saving if it is blank.
|
| 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.8
|
| 7 |
+
Stable tag: 1.3.0
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 77 |
|
| 78 |
== Changelog ==
|
| 79 |
|
| 80 |
+
= 1.3.0 =
|
| 81 |
+
* Plugin will display an error message if log file is not writeable when "Clear Log" is clicked.
|
| 82 |
+
* Actual SMTP password is replaced by a gag on the settings page.
|
| 83 |
+
* Fixed minor bug in Reply-To option handling (thanks to arildur).
|
| 84 |
+
* Some improvements in developers-related options (thanks to erikmolenaar).
|
| 85 |
+
|
| 86 |
= 1.2.9 =
|
| 87 |
* Added additional setting option to deal with email aliases (thanks to bradclarke365).
|
| 88 |
* Fixed "Reply-To" option wasn't saving if it is blank.
|
