Version Description
- Added additional setting option to deal with email aliases (thanks to bradclarke365).
- Fixed "Reply-To" option wasn't saving if it is blank.
Download this release
Release Info
Developer | mra13 |
Plugin | Easy WP SMTP |
Version | 1.2.9 |
Comparing to | |
See all releases |
Code changes from version 1.2.7 to 1.2.9
- css/style.css +5 -1
- easy-wp-smtp-admin-menu.php +113 -19
- easy-wp-smtp.php +121 -16
- readme.txt +12 -2
css/style.css
CHANGED
@@ -1,7 +1,11 @@
|
|
1 |
/**
|
2 |
* Settings page
|
3 |
*/
|
4 |
-
#swpsmtp_settings_form input[type='text'],
|
|
|
|
|
|
|
|
|
5 |
width: 350px;
|
6 |
}
|
7 |
textarea#swpsmtp_message{
|
1 |
/**
|
2 |
* Settings page
|
3 |
*/
|
4 |
+
#swpsmtp_settings_form input[type='text'],
|
5 |
+
#swpsmtp_settings_form input[type='password'],
|
6 |
+
#swpsmtp_settings_form input[type='email'],
|
7 |
+
#swpsmtp_settings_form input:disabled
|
8 |
+
{
|
9 |
width: 350px;
|
10 |
}
|
11 |
textarea#swpsmtp_message{
|
easy-wp-smtp-admin-menu.php
CHANGED
@@ -22,8 +22,8 @@ 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 |
}
|
28 |
|
29 |
if (isset($_POST['swpsmtp_form_submit']) && check_admin_referer(plugin_basename(__FILE__), 'swpsmtp_nonce_name')) {
|
@@ -36,6 +36,13 @@ function swpsmtp_settings() {
|
|
36 |
$error .= " " . __("Please enter a valid email address in the 'FROM' field.", 'easy-wp-smtp');
|
37 |
}
|
38 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
$swpsmtp_options['smtp_settings']['host'] = sanitize_text_field($_POST['swpsmtp_smtp_host']);
|
41 |
$swpsmtp_options['smtp_settings']['type_encryption'] = ( isset($_POST['swpsmtp_smtp_type_encryption']) ) ? sanitize_text_field($_POST['swpsmtp_smtp_type_encryption']) : 'none';
|
@@ -43,6 +50,9 @@ function swpsmtp_settings() {
|
|
43 |
$swpsmtp_options['smtp_settings']['username'] = sanitize_text_field($_POST['swpsmtp_smtp_username']);
|
44 |
$smtp_password = stripslashes($_POST['swpsmtp_smtp_password']);
|
45 |
$swpsmtp_options['smtp_settings']['password'] = base64_encode($smtp_password);
|
|
|
|
|
|
|
46 |
|
47 |
/* Check value from "SMTP port" option */
|
48 |
if (isset($_POST['swpsmtp_smtp_port'])) {
|
@@ -76,13 +86,13 @@ function swpsmtp_settings() {
|
|
76 |
}
|
77 |
$swpsmtp_subject = isset($_POST['swpsmtp_subject']) ? sanitize_text_field($_POST['swpsmtp_subject']) : '';
|
78 |
$swpsmtp_message = isset($_POST['swpsmtp_message']) ? sanitize_text_field($_POST['swpsmtp_message']) : '';
|
79 |
-
|
80 |
//Save the test mail details so it doesn't need to be filled in everytime.
|
81 |
$smtp_test_mail['swpsmtp_to'] = $swpsmtp_to;
|
82 |
$smtp_test_mail['swpsmtp_subject'] = $swpsmtp_subject;
|
83 |
$smtp_test_mail['swpsmtp_message'] = $swpsmtp_message;
|
84 |
update_option('smtp_test_mail', $smtp_test_mail);
|
85 |
-
|
86 |
if (!empty($swpsmtp_to)) {
|
87 |
$result = swpsmtp_test_mail($swpsmtp_to, $swpsmtp_subject, $swpsmtp_message);
|
88 |
}
|
@@ -101,14 +111,14 @@ function swpsmtp_settings() {
|
|
101 |
<div id="swpsmtp-settings-notice" class="updated fade" style="display:none">
|
102 |
<p><strong><?php _e("Notice:", 'easy-wp-smtp'); ?></strong> <?php _e("The plugin's settings have been changed. In order to save them please don't forget to click the 'Save Changes' button.", 'easy-wp-smtp'); ?></p>
|
103 |
</div>
|
|
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
|
|
108 |
|
109 |
-
<p>You can request your hosting provider for the SMTP details of your site. Use the SMTP details provided by your hosting provider to configure the following settings.</p>
|
110 |
-
|
111 |
-
<form id="swpsmtp_settings_form" method="post" action="">
|
112 |
<table class="form-table">
|
113 |
<tr valign="top">
|
114 |
<th scope="row"><?php _e("From Email Address", 'easy-wp-smtp'); ?></th>
|
@@ -124,6 +134,13 @@ function swpsmtp_settings() {
|
|
124 |
<p class="description"><?php _e("This text will be used in the 'FROM' field", 'easy-wp-smtp'); ?></p>
|
125 |
</td>
|
126 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
<tr class="ad_opt swpsmtp_smtp_options">
|
128 |
<th><?php _e('SMTP Host', 'easy-wp-smtp'); ?></th>
|
129 |
<td>
|
@@ -168,27 +185,82 @@ function swpsmtp_settings() {
|
|
168 |
<input type='password' name='swpsmtp_smtp_password' value='<?php echo esc_attr(swpsmtp_get_password()); ?>' /><br />
|
169 |
<p class="description"><?php _e("The password to login to your mail server", 'easy-wp-smtp'); ?></p>
|
170 |
</td>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
</table>
|
173 |
<p class="submit">
|
174 |
<input type="submit" id="settings-form-submit" class="button-primary" value="<?php _e('Save Changes', 'easy-wp-smtp') ?>" />
|
175 |
<input type="hidden" name="swpsmtp_form_submit" value="submit" />
|
176 |
<?php wp_nonce_field(plugin_basename(__FILE__), 'swpsmtp_nonce_name'); ?>
|
177 |
</p>
|
178 |
-
</form>
|
179 |
-
</div><!-- end of inside -->
|
180 |
-
</div><!-- end of postbox -->
|
181 |
-
|
182 |
-
<div class="updated fade" <?php if (empty($result)) echo "style=\"display:none\""; ?>>
|
183 |
-
<p><strong><?php echo $result; ?></strong></p><!-- shows the result from the test email send function -->
|
184 |
-
</div>
|
185 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
<div class="postbox">
|
187 |
-
<h3 class="hndle"><label for="title"><?php _e('
|
188 |
<div class="inside">
|
189 |
|
190 |
<p>You can use this section to send an email from your server using the above configured SMTP details to see if the email gets delivered.</p>
|
191 |
-
|
|
|
192 |
<form id="swpsmtp_settings_form" method="post" action="">
|
193 |
<table class="form-table">
|
194 |
<tr valign="top">
|
@@ -222,6 +294,10 @@ function swpsmtp_settings() {
|
|
222 |
</div><!-- end of inside -->
|
223 |
</div><!-- end of postbox -->
|
224 |
|
|
|
|
|
|
|
|
|
225 |
<?php
|
226 |
echo '</div></div>'; //<!-- end of #poststuff and #post-body -->
|
227 |
echo '</div>'; //<!-- end of .wrap #swpsmtp-mail .swpsmtp-mail -->
|
@@ -239,6 +315,24 @@ function swpsmtp_admin_init() {
|
|
239 |
/* register plugin settings */
|
240 |
swpsmtp_register_settings();
|
241 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
}
|
243 |
|
244 |
/**
|
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 |
}
|
28 |
|
29 |
if (isset($_POST['swpsmtp_form_submit']) && check_admin_referer(plugin_basename(__FILE__), 'swpsmtp_nonce_name')) {
|
36 |
$error .= " " . __("Please enter a valid email address in the 'FROM' field.", 'easy-wp-smtp');
|
37 |
}
|
38 |
}
|
39 |
+
if (isset($_POST['swpsmtp_reply_to_email'])) {
|
40 |
+
$swpsmtp_options['reply_to_email'] = sanitize_email($_POST['swpsmtp_reply_to_email']);
|
41 |
+
}
|
42 |
+
|
43 |
+
if (isset($_POST['swpsmtp_email_ignore_list'])) {
|
44 |
+
$swpsmtp_options['email_ignore_list'] = sanitize_text_field($_POST['swpsmtp_email_ignore_list']);
|
45 |
+
}
|
46 |
|
47 |
$swpsmtp_options['smtp_settings']['host'] = sanitize_text_field($_POST['swpsmtp_smtp_host']);
|
48 |
$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']['username'] = sanitize_text_field($_POST['swpsmtp_smtp_username']);
|
51 |
$smtp_password = stripslashes($_POST['swpsmtp_smtp_password']);
|
52 |
$swpsmtp_options['smtp_settings']['password'] = base64_encode($smtp_password);
|
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 |
+
$swpsmtp_options['allowed_domains'] = isset($_POST['swpsmtp_allowed_domains']) ? sanitize_text_field($_POST['swpsmtp_allowed_domains']) : (isset($swpsmtp_options['allowed_domains']) ? $swpsmtp_options['allowed_domains'] : '');
|
56 |
|
57 |
/* Check value from "SMTP port" option */
|
58 |
if (isset($_POST['swpsmtp_smtp_port'])) {
|
86 |
}
|
87 |
$swpsmtp_subject = isset($_POST['swpsmtp_subject']) ? sanitize_text_field($_POST['swpsmtp_subject']) : '';
|
88 |
$swpsmtp_message = isset($_POST['swpsmtp_message']) ? sanitize_text_field($_POST['swpsmtp_message']) : '';
|
89 |
+
|
90 |
//Save the test mail details so it doesn't need to be filled in everytime.
|
91 |
$smtp_test_mail['swpsmtp_to'] = $swpsmtp_to;
|
92 |
$smtp_test_mail['swpsmtp_subject'] = $swpsmtp_subject;
|
93 |
$smtp_test_mail['swpsmtp_message'] = $swpsmtp_message;
|
94 |
update_option('smtp_test_mail', $smtp_test_mail);
|
95 |
+
|
96 |
if (!empty($swpsmtp_to)) {
|
97 |
$result = swpsmtp_test_mail($swpsmtp_to, $swpsmtp_subject, $swpsmtp_message);
|
98 |
}
|
111 |
<div id="swpsmtp-settings-notice" class="updated fade" style="display:none">
|
112 |
<p><strong><?php _e("Notice:", 'easy-wp-smtp'); ?></strong> <?php _e("The plugin's settings have been changed. In order to save them please don't forget to click the 'Save Changes' button.", 'easy-wp-smtp'); ?></p>
|
113 |
</div>
|
114 |
+
<form id="swpsmtp_settings_form" method="post" action="">
|
115 |
|
116 |
+
<div class="postbox">
|
117 |
+
<h3 class="hndle"><label for="title"><?php _e('SMTP Configuration Settings', 'easy-wp-smtp'); ?></label></h3>
|
118 |
+
<div class="inside">
|
119 |
+
|
120 |
+
<p>You can request your hosting provider for the SMTP details of your site. Use the SMTP details provided by your hosting provider to configure the following settings.</p>
|
121 |
|
|
|
|
|
|
|
122 |
<table class="form-table">
|
123 |
<tr valign="top">
|
124 |
<th scope="row"><?php _e("From Email Address", 'easy-wp-smtp'); ?></th>
|
134 |
<p class="description"><?php _e("This text will be used in the 'FROM' field", 'easy-wp-smtp'); ?></p>
|
135 |
</td>
|
136 |
</tr>
|
137 |
+
<tr valign="top">
|
138 |
+
<th scope="row"><?php _e("Reply-To Email Address", 'easy-wp-smtp'); ?></th>
|
139 |
+
<td>
|
140 |
+
<input type="email" name="swpsmtp_reply_to_email" value="<?php echo isset($swpsmtp_options['reply_to_email']) ? esc_attr($swpsmtp_options['reply_to_email']) : ''; ?>"/><br />
|
141 |
+
<p class="description"><?php _e("Optional. This email address will be used in the 'Reply-To' field of the email. Leave it blank to use 'From' email as the reply-to value.", 'easy-wp-smtp'); ?></p>
|
142 |
+
</td>
|
143 |
+
</tr>
|
144 |
<tr class="ad_opt swpsmtp_smtp_options">
|
145 |
<th><?php _e('SMTP Host', 'easy-wp-smtp'); ?></th>
|
146 |
<td>
|
185 |
<input type='password' name='swpsmtp_smtp_password' value='<?php echo esc_attr(swpsmtp_get_password()); ?>' /><br />
|
186 |
<p class="description"><?php _e("The password to login to your mail server", 'easy-wp-smtp'); ?></p>
|
187 |
</td>
|
188 |
+
</tr>
|
189 |
+
</table>
|
190 |
+
<p class="submit">
|
191 |
+
<input type="submit" id="settings-form-submit" class="button-primary" value="<?php _e('Save Changes', 'easy-wp-smtp') ?>" />
|
192 |
+
</p>
|
193 |
+
</div><!-- end of inside -->
|
194 |
+
</div><!-- end of postbox -->
|
195 |
+
|
196 |
+
<div class="postbox">
|
197 |
+
<h3 class="hndle"><label for="title"><?php _e('Additional Settings (Optional)', 'easy-wp-smtp'); ?></label></h3>
|
198 |
+
<div class="inside">
|
199 |
+
<table class="form-table">
|
200 |
+
<tr valign="top">
|
201 |
+
<th scope="row"><?php _e("Don't Replace \"From\" Field", 'easy-wp-smtp'); ?></th>
|
202 |
+
<td>
|
203 |
+
<input type="text" name="swpsmtp_email_ignore_list" value="<?php echo isset($swpsmtp_options['email_ignore_list']) ? esc_attr($swpsmtp_options['email_ignore_list']) : ''; ?>"/><br />
|
204 |
+
<p class="description"><?php _e("Comma separated emails list. Example value: email1@domain.com, email2@domain.com", "easy-wp-smtp"); ?></p>
|
205 |
+
<p class="description"><?php _e("This option is useful when you are using several email aliases on your SMTP server. If you don't want your aliases to be replaced by the address specified in \"From\" field, enter them in this field.", 'easy-wp-smtp'); ?></p>
|
206 |
+
</td>
|
207 |
</tr>
|
208 |
+
<tr valign="top">
|
209 |
+
<th scope="row"><?php _e("Enable Domain Check", 'easy-wp-smtp'); ?></th>
|
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>
|
217 |
+
<tr valign="top">
|
218 |
+
<th scope="row"><?php _e("Enable Debug Log", 'easy-wp-smtp'); ?></th>
|
219 |
+
<td>
|
220 |
+
<input type="checkbox" name="swpsmtp_enable_debug" value="1" <?php echo (isset($swpsmtp_options['smtp_settings']['enable_debug']) && ($swpsmtp_options['smtp_settings']['enable_debug'])) ? 'checked' : ''; ?>/>
|
221 |
+
<p class="description"><?php _e("Check this box to enable mail debug log", 'easy-wp-smtp'); ?></p>
|
222 |
+
<a href="<?php echo admin_url(); ?>?swpsmtp_action=view_log" target="_blank"><?php _e('View Log', 'easy-wp-smtp'); ?></a> | <a style="color: red;" id="swpsmtp_clear_log_btn" href="#0"><?php _e('Clear Log', 'easy-wp-smtp'); ?></a>
|
223 |
+
</td>
|
224 |
+
</tr>
|
225 |
</table>
|
226 |
<p class="submit">
|
227 |
<input type="submit" id="settings-form-submit" class="button-primary" value="<?php _e('Save Changes', 'easy-wp-smtp') ?>" />
|
228 |
<input type="hidden" name="swpsmtp_form_submit" value="submit" />
|
229 |
<?php wp_nonce_field(plugin_basename(__FILE__), 'swpsmtp_nonce_name'); ?>
|
230 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
|
232 |
+
<script>
|
233 |
+
jQuery(function ($) {
|
234 |
+
$('#swpsmtp_enable_domain_check').change(function () {
|
235 |
+
$('input[name="swpsmtp_allowed_domains"]').prop('disabled', !$(this).is(':checked'));
|
236 |
+
});
|
237 |
+
$('#swpsmtp_clear_log_btn').click(function (e) {
|
238 |
+
e.preventDefault();
|
239 |
+
if (confirm("<?php _e('Are you sure want to clear log?', 'easy-wp-smtp'); ?>")) {
|
240 |
+
var req = jQuery.ajax({
|
241 |
+
url: ajaxurl,
|
242 |
+
type: "post",
|
243 |
+
data: {action: "swpsmtp_clear_log"}
|
244 |
+
});
|
245 |
+
req.done(function (data) {
|
246 |
+
if (data === '1') {
|
247 |
+
alert("<?php _e('Log cleared.', 'easy-wp-smtp'); ?>");
|
248 |
+
}
|
249 |
+
});
|
250 |
+
}
|
251 |
+
});
|
252 |
+
});
|
253 |
+
</script>
|
254 |
+
</div><!-- end of inside -->
|
255 |
+
</div><!-- end of postbox -->
|
256 |
+
</form>
|
257 |
<div class="postbox">
|
258 |
+
<h3 class="hndle"><label for="title"><?php _e('Test Email', 'easy-wp-smtp'); ?></label></h3>
|
259 |
<div class="inside">
|
260 |
|
261 |
<p>You can use this section to send an email from your server using the above configured SMTP details to see if the email gets delivered.</p>
|
262 |
+
<p><b>Note</b>: debug log for this test email will be automatically displayed right after you send it. Test email also ignores "Enable Domain Check" option.</p>
|
263 |
+
|
264 |
<form id="swpsmtp_settings_form" method="post" action="">
|
265 |
<table class="form-table">
|
266 |
<tr valign="top">
|
294 |
</div><!-- end of inside -->
|
295 |
</div><!-- end of postbox -->
|
296 |
|
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 -->
|
315 |
/* register plugin settings */
|
316 |
swpsmtp_register_settings();
|
317 |
}
|
318 |
+
add_action('wp_ajax_swpsmtp_clear_log', 'swpsmtp_clear_log');
|
319 |
+
//view log file
|
320 |
+
if (isset($_GET['swpsmtp_action'])) {
|
321 |
+
if ($_GET['swpsmtp_action'] === 'view_log') {
|
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) {
|
329 |
+
wp_die('Can\'t open log file.');
|
330 |
+
}
|
331 |
+
header('Content-Type: text/plain');
|
332 |
+
fpassthru($logfile);
|
333 |
+
die;
|
334 |
+
}
|
335 |
+
}
|
336 |
}
|
337 |
|
338 |
/**
|
easy-wp-smtp.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Plugin Name: Easy WP SMTP
|
4 |
-
Version: 1.2.
|
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/
|
8 |
-
Description: Send email via SMTP from your WordPress Blog
|
9 |
-
Text Domain: easy-wp-smtp
|
10 |
-
Domain Path: /languages
|
11 |
-
*/
|
12 |
|
13 |
//Prefix/Slug - swpsmtp
|
14 |
|
@@ -81,6 +81,27 @@ if (!function_exists('swpsmtp_admin_head')) {
|
|
81 |
|
82 |
}
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
/**
|
85 |
* Function to add smtp options in the phpmailer_init
|
86 |
* @return void
|
@@ -93,11 +114,70 @@ if (!function_exists('swpsmtp_init_smtp')) {
|
|
93 |
return;
|
94 |
}
|
95 |
$swpsmtp_options = get_option('swpsmtp_options');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
/* Set the mailer type as per config above, this overrides the already called isMail method */
|
97 |
$phpmailer->IsSMTP();
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
$from_email = $swpsmtp_options['from_email_field'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
$phpmailer->From = $from_email;
|
100 |
-
$from_name = $swpsmtp_options['from_name_field'];
|
101 |
$phpmailer->FromName = $from_name;
|
102 |
$phpmailer->SetFrom($phpmailer->From, $phpmailer->FromName);
|
103 |
/* Set the SMTPSecure value */
|
@@ -117,6 +197,12 @@ if (!function_exists('swpsmtp_init_smtp')) {
|
|
117 |
}
|
118 |
//PHPMailer 5.2.10 introduced this option. However, this might cause issues if the server is advertising TLS with an invalid certificate.
|
119 |
$phpmailer->SMTPAutoTLS = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
}
|
121 |
|
122 |
}
|
@@ -164,14 +250,20 @@ if (!function_exists('swpsmtp_test_mail')) {
|
|
164 |
/* Set the other options */
|
165 |
$mail->Host = $swpsmtp_options['smtp_settings']['host'];
|
166 |
$mail->Port = $swpsmtp_options['smtp_settings']['port'];
|
|
|
|
|
|
|
167 |
$mail->SetFrom($from_email, $from_name);
|
168 |
$mail->isHTML(true);
|
169 |
$mail->Subject = $subject;
|
170 |
$mail->MsgHTML($message);
|
171 |
$mail->AddAddress($to_email);
|
172 |
global $debugMSG;
|
173 |
-
$debugMSG='';
|
174 |
-
$mail->Debugoutput=function($str, $level) {
|
|
|
|
|
|
|
175 |
$mail->SMTPDebug = 1;
|
176 |
|
177 |
/* Send mail and return result */
|
@@ -182,7 +274,7 @@ if (!function_exists('swpsmtp_test_mail')) {
|
|
182 |
$mail->ClearAllRecipients();
|
183 |
|
184 |
echo '<div class="swpsmtp-yellow-box"><h3>Debug Info</h3>';
|
185 |
-
echo '<textarea rows="20" style="width: 100%;">'
|
186 |
echo '</div>';
|
187 |
|
188 |
if (!empty($errors)) {
|
@@ -260,13 +352,25 @@ if (!function_exists('swpsmtp_send_uninstall')) {
|
|
260 |
|
261 |
function swpsmtp_send_uninstall() {
|
262 |
/* Don't delete plugin options. It is better to retain the options so if someone accidentally deactivates, the configuration is not lost. */
|
263 |
-
|
264 |
//delete_site_option('swpsmtp_options');
|
265 |
//delete_option('swpsmtp_options');
|
266 |
}
|
267 |
|
268 |
}
|
269 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
/**
|
271 |
* Add all hooks
|
272 |
*/
|
@@ -274,7 +378,7 @@ add_filter('plugin_action_links', 'swpsmtp_plugin_action_links', 10, 2);
|
|
274 |
add_action('plugins_loaded', 'swpsmtp_plugins_loaded_handler');
|
275 |
add_filter('plugin_row_meta', 'swpsmtp_register_plugin_links', 10, 2);
|
276 |
|
277 |
-
add_action('phpmailer_init', 'swpsmtp_init_smtp');
|
278 |
|
279 |
add_action('admin_menu', 'swpsmtp_admin_default_setup');
|
280 |
|
@@ -282,4 +386,5 @@ add_action('admin_init', 'swpsmtp_admin_init');
|
|
282 |
add_action('admin_enqueue_scripts', 'swpsmtp_admin_head');
|
283 |
add_action('admin_notices', 'swpsmtp_admin_notice');
|
284 |
|
285 |
-
|
|
1 |
<?php
|
2 |
/*
|
3 |
+
Plugin Name: Easy WP SMTP
|
4 |
+
Version: 1.2.9
|
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/
|
8 |
+
Description: Send email via SMTP from your WordPress Blog
|
9 |
+
Text Domain: easy-wp-smtp
|
10 |
+
Domain Path: /languages
|
11 |
+
*/
|
12 |
|
13 |
//Prefix/Slug - swpsmtp
|
14 |
|
81 |
|
82 |
}
|
83 |
|
84 |
+
function swpsmtp_clear_log() {
|
85 |
+
swpsmtp_write_to_log("Easy WP SMTP debug log file\r\n\r\n", true);
|
86 |
+
echo '1';
|
87 |
+
die;
|
88 |
+
}
|
89 |
+
|
90 |
+
function swpsmtp_write_to_log($str, $overwrite = false) {
|
91 |
+
$swpsmtp_options = get_option('swpsmtp_options');
|
92 |
+
if (isset($swpsmtp_options['smtp_settings']['log_file_name'])) {
|
93 |
+
$log_file_name = $swpsmtp_options['smtp_settings']['log_file_name'];
|
94 |
+
} else {
|
95 |
+
// let's generate log file name
|
96 |
+
$log_file_name = uniqid() . '_debug_log.txt';
|
97 |
+
if (file_put_contents(plugin_dir_path(__FILE__) . $log_file_name, "Easy WP SMTP debug log file\r\n\r\n")) {
|
98 |
+
$swpsmtp_options['smtp_settings']['log_file_name'] = $log_file_name;
|
99 |
+
update_option('swpsmtp_options', $swpsmtp_options);
|
100 |
+
}
|
101 |
+
}
|
102 |
+
file_put_contents(plugin_dir_path(__FILE__) . $log_file_name, $str, (!$overwrite ? FILE_APPEND : 0));
|
103 |
+
}
|
104 |
+
|
105 |
/**
|
106 |
* Function to add smtp options in the phpmailer_init
|
107 |
* @return void
|
114 |
return;
|
115 |
}
|
116 |
$swpsmtp_options = get_option('swpsmtp_options');
|
117 |
+
//check if Domain Check enabled
|
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 singe domain
|
127 |
+
unset($domains_arr);
|
128 |
+
$domains_arr = array($swpsmtp_options['allowed_domains']);
|
129 |
+
}
|
130 |
+
$site_domain = parse_url(get_site_url(), PHP_URL_HOST);
|
131 |
+
$match_found = false;
|
132 |
+
foreach ($domains_arr as $domain) {
|
133 |
+
if (strtolower(trim($domain)) === strtolower(trim($site_domain))) {
|
134 |
+
$match_found = true;
|
135 |
+
break;
|
136 |
+
}
|
137 |
+
}
|
138 |
+
if (!$match_found) {
|
139 |
+
swpsmtp_write_to_log(
|
140 |
+
"\r\n-------------------------------------------------------------------------------------------------------\r\n" .
|
141 |
+
"Domain check failed: website domain (" . $site_domain . ") is not in allowed domains list.\r\n" .
|
142 |
+
"-------------------------------------------------------------------------------------------------------\r\n\r\n");
|
143 |
+
return;
|
144 |
+
}
|
145 |
+
}
|
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 singe email
|
163 |
+
unset($emails_arr);
|
164 |
+
$emails_arr = array($swpsmtp_options['email_ignore_list']);
|
165 |
+
}
|
166 |
+
$from = $phpmailer->From;
|
167 |
+
$match_found = false;
|
168 |
+
foreach ($emails_arr as $email) {
|
169 |
+
if (strtolower(trim($email)) === strtolower(trim($from))) {
|
170 |
+
$match_found = true;
|
171 |
+
break;
|
172 |
+
}
|
173 |
+
}
|
174 |
+
if ($match_found) {
|
175 |
+
//we should not override From and Fromname
|
176 |
+
$from_email = $phpmailer->From;
|
177 |
+
$from_name = $phpmailer->FromName;
|
178 |
+
}
|
179 |
+
}
|
180 |
$phpmailer->From = $from_email;
|
|
|
181 |
$phpmailer->FromName = $from_name;
|
182 |
$phpmailer->SetFrom($phpmailer->From, $phpmailer->FromName);
|
183 |
/* Set the SMTPSecure value */
|
197 |
}
|
198 |
//PHPMailer 5.2.10 introduced this option. However, this might cause issues if the server is advertising TLS with an invalid certificate.
|
199 |
$phpmailer->SMTPAutoTLS = false;
|
200 |
+
if (isset($swpsmtp_options['smtp_settings']['enable_debug']) && $swpsmtp_options['smtp_settings']['enable_debug']) {
|
201 |
+
$phpmailer->Debugoutput = function($str, $level) {
|
202 |
+
swpsmtp_write_to_log($str);
|
203 |
+
};
|
204 |
+
$phpmailer->SMTPDebug = 1;
|
205 |
+
}
|
206 |
}
|
207 |
|
208 |
}
|
250 |
/* Set the other options */
|
251 |
$mail->Host = $swpsmtp_options['smtp_settings']['host'];
|
252 |
$mail->Port = $swpsmtp_options['smtp_settings']['port'];
|
253 |
+
if (!empty($swpsmtp_options['reply_to_email'])) {
|
254 |
+
$mail->AddReplyTo($swpsmtp_options['reply_to_email'], $from_name);
|
255 |
+
}
|
256 |
$mail->SetFrom($from_email, $from_name);
|
257 |
$mail->isHTML(true);
|
258 |
$mail->Subject = $subject;
|
259 |
$mail->MsgHTML($message);
|
260 |
$mail->AddAddress($to_email);
|
261 |
global $debugMSG;
|
262 |
+
$debugMSG = '';
|
263 |
+
$mail->Debugoutput = function($str, $level) {
|
264 |
+
global $debugMSG;
|
265 |
+
$debugMSG .= $str;
|
266 |
+
};
|
267 |
$mail->SMTPDebug = 1;
|
268 |
|
269 |
/* Send mail and return result */
|
274 |
$mail->ClearAllRecipients();
|
275 |
|
276 |
echo '<div class="swpsmtp-yellow-box"><h3>Debug Info</h3>';
|
277 |
+
echo '<textarea rows="20" style="width: 100%;">' . $debugMSG . '</textarea>';
|
278 |
echo '</div>';
|
279 |
|
280 |
if (!empty($errors)) {
|
352 |
|
353 |
function swpsmtp_send_uninstall() {
|
354 |
/* Don't delete plugin options. It is better to retain the options so if someone accidentally deactivates, the configuration is not lost. */
|
355 |
+
|
356 |
//delete_site_option('swpsmtp_options');
|
357 |
//delete_option('swpsmtp_options');
|
358 |
}
|
359 |
|
360 |
}
|
361 |
|
362 |
+
function swpsmtp_activate() {
|
363 |
+
$swpsmtp_options = get_option('swpsmtp_options');
|
364 |
+
//add current domain to allowed domains list
|
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 |
+
|
374 |
/**
|
375 |
* Add all hooks
|
376 |
*/
|
378 |
add_action('plugins_loaded', 'swpsmtp_plugins_loaded_handler');
|
379 |
add_filter('plugin_row_meta', 'swpsmtp_register_plugin_links', 10, 2);
|
380 |
|
381 |
+
add_action('phpmailer_init', 'swpsmtp_init_smtp', 999);
|
382 |
|
383 |
add_action('admin_menu', 'swpsmtp_admin_default_setup');
|
384 |
|
386 |
add_action('admin_enqueue_scripts', 'swpsmtp_admin_head');
|
387 |
add_action('admin_notices', 'swpsmtp_admin_notice');
|
388 |
|
389 |
+
register_activation_hook(__FILE__, 'swpsmtp_activate');
|
390 |
+
register_uninstall_hook(plugin_basename(__FILE__), 'swpsmtp_send_uninstall');
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Easy WP SMTP ===
|
2 |
-
Contributors: wpecommerce, wp.insider
|
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.8
|
7 |
-
Stable tag: 1.2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -20,6 +20,8 @@ Easy WP SMTP allows you to configure and send all outgoing emails via a SMTP ser
|
|
20 |
* You can use Gmail, Yahoo, Hotmail's SMTP server if you have an account with them.
|
21 |
* Seamlessly connect your WordPress blog with a mail server to handle all outgoing emails (it's as if the email has been composed inside your mail account).
|
22 |
* Securely deliver emails to your recipients.
|
|
|
|
|
23 |
|
24 |
= Easy WP SMTP Plugin Usage =
|
25 |
|
@@ -75,6 +77,14 @@ Inspired by [WP Mail SMTP](http://wordpress.org/plugins/wp-mail-smtp/) plugin
|
|
75 |
|
76 |
== Changelog ==
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
= 1.2.7 =
|
79 |
* Added extra debug info (when test email function is used). This debug info will show more details if anything fails. This will be helpful to debug SMTP connection failure on your server.
|
80 |
|
1 |
=== Easy WP SMTP ===
|
2 |
+
Contributors: wpecommerce, wp.insider, alexanderfoxc
|
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.8
|
7 |
+
Stable tag: 1.2.9
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
20 |
* You can use Gmail, Yahoo, Hotmail's SMTP server if you have an account with them.
|
21 |
* Seamlessly connect your WordPress blog with a mail server to handle all outgoing emails (it's as if the email has been composed inside your mail account).
|
22 |
* Securely deliver emails to your recipients.
|
23 |
+
* Option to enable debug logging to see if the emails are getting sent out successfully or not.
|
24 |
+
* Ability to specify a Reply-to email address.
|
25 |
|
26 |
= Easy WP SMTP Plugin Usage =
|
27 |
|
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.
|
83 |
+
|
84 |
+
= 1.2.8 =
|
85 |
+
* New settings option to specify a reply-to email address.
|
86 |
+
* There is a new settings option to enable debug logging.
|
87 |
+
|
88 |
= 1.2.7 =
|
89 |
* Added extra debug info (when test email function is used). This debug info will show more details if anything fails. This will be helpful to debug SMTP connection failure on your server.
|
90 |
|