Version Description
- Addition of Pepipost and cleanup of admin page.
Download this release
Release Info
Developer | chmac |
Plugin | WP Mail SMTP by WPForms |
Version | 0.10.0 |
Comparing to | |
See all releases |
Code changes from version 0.9.6 to 0.10.0
- .gitignore +1 -0
- README.md +4 -0
- readme.txt +11 -3
- wp_mail_smtp.php +162 -64
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.sync-config.cson
|
README.md
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
WP Mail SMTP
|
2 |
+
---
|
3 |
+
|
4 |
+
https://wordpress.org/plugins/wp-mail-smtp/
|
readme.txt
CHANGED
@@ -3,10 +3,10 @@ Contributors: chmac
|
|
3 |
Donate link: http://www.callum-macdonald.com/code/donate/
|
4 |
Tags: mail, smtp, wp_mail, mailer, phpmailer
|
5 |
Requires at least: 2.7
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 0.
|
8 |
|
9 |
-
|
10 |
|
11 |
== Description ==
|
12 |
|
@@ -22,6 +22,8 @@ You can set the following options:
|
|
22 |
* Choose to use SMTP authentication or not (defaults to not).
|
23 |
* Specify an SMTP username and password.
|
24 |
|
|
|
|
|
25 |
== Installation ==
|
26 |
|
27 |
1. Download
|
@@ -62,6 +64,9 @@ By all means please contact me to discuss features or options you'd like to see
|
|
62 |
|
63 |
== Changelog ==
|
64 |
|
|
|
|
|
|
|
65 |
= 0.9.6 =
|
66 |
* Minor security fix, sanitize test email address.
|
67 |
|
@@ -152,6 +157,9 @@ By all means please contact me to discuss features or options you'd like to see
|
|
152 |
|
153 |
== Upgrade Notice ==
|
154 |
|
|
|
|
|
|
|
155 |
= 0.9.6 =
|
156 |
Minor security fix, sanitize test email address.
|
157 |
|
3 |
Donate link: http://www.callum-macdonald.com/code/donate/
|
4 |
Tags: mail, smtp, wp_mail, mailer, phpmailer
|
5 |
Requires at least: 2.7
|
6 |
+
Tested up to: 4.7
|
7 |
+
Stable tag: 0.10.0
|
8 |
|
9 |
+
The most popular SMTP plugin on WordPress.org. Trusted by over 500'000 sites.
|
10 |
|
11 |
== Description ==
|
12 |
|
22 |
* Choose to use SMTP authentication or not (defaults to not).
|
23 |
* Specify an SMTP username and password.
|
24 |
|
25 |
+
The plugin includes integrated support for <a href="https://app1.pepipost.com/index.php/login/wp_mail_smtp?page=signup&utm_source=WordPress&utm_campaign=Plugins&utm_medium=wp_mail_smtp_webpage&utm_term=organic&code=WP-MAIL-SMTP">Pepipost</a>.
|
26 |
+
|
27 |
== Installation ==
|
28 |
|
29 |
1. Download
|
64 |
|
65 |
== Changelog ==
|
66 |
|
67 |
+
= 0.10.0 =
|
68 |
+
* Addition of Pepipost and cleanup of admin page.
|
69 |
+
|
70 |
= 0.9.6 =
|
71 |
* Minor security fix, sanitize test email address.
|
72 |
|
157 |
|
158 |
== Upgrade Notice ==
|
159 |
|
160 |
+
= 0.10.0 =
|
161 |
+
Addition of Pepipost and cleanup of admin page.
|
162 |
+
|
163 |
= 0.9.6 =
|
164 |
Minor security fix, sanitize test email address.
|
165 |
|
wp_mail_smtp.php
CHANGED
@@ -17,7 +17,7 @@ Author URI: http://www.callum-macdonald.com/
|
|
17 |
|
18 |
/**
|
19 |
* Setting options in wp-config.php
|
20 |
-
*
|
21 |
* Specifically aimed at WPMU users, you can set the options for this plugin as
|
22 |
* constants in wp-config.php. This disables the plugin's admin page and may
|
23 |
* improve performance very slightly. Copy the code below into wp-config.php.
|
@@ -48,7 +48,11 @@ $wpms_options = array (
|
|
48 |
'smtp_ssl' => 'none',
|
49 |
'smtp_auth' => false,
|
50 |
'smtp_user' => '',
|
51 |
-
'smtp_pass' => ''
|
|
|
|
|
|
|
|
|
52 |
);
|
53 |
|
54 |
|
@@ -57,27 +61,27 @@ $wpms_options = array (
|
|
57 |
*/
|
58 |
if (!function_exists('wp_mail_smtp_activate')) :
|
59 |
function wp_mail_smtp_activate() {
|
60 |
-
|
61 |
global $wpms_options;
|
62 |
-
|
63 |
// Create the required options...
|
64 |
foreach ($wpms_options as $name => $val) {
|
65 |
add_option($name,$val);
|
66 |
}
|
67 |
-
|
68 |
}
|
69 |
endif;
|
70 |
|
71 |
if (!function_exists('wp_mail_smtp_whitelist_options')) :
|
72 |
function wp_mail_smtp_whitelist_options($whitelist_options) {
|
73 |
-
|
74 |
global $wpms_options;
|
75 |
-
|
76 |
// Add our options to the array
|
77 |
$whitelist_options['email'] = array_keys($wpms_options);
|
78 |
-
|
79 |
return $whitelist_options;
|
80 |
-
|
81 |
}
|
82 |
endif;
|
83 |
|
@@ -85,15 +89,15 @@ endif;
|
|
85 |
if (!function_exists('phpmailer_init_smtp')) :
|
86 |
// This code is copied, from wp-includes/pluggable.php as at version 2.2.2
|
87 |
function phpmailer_init_smtp($phpmailer) {
|
88 |
-
|
89 |
// If constants are defined, apply those options
|
90 |
if (defined('WPMS_ON') && WPMS_ON) {
|
91 |
-
|
92 |
$phpmailer->Mailer = WPMS_MAILER;
|
93 |
-
|
94 |
if (WPMS_SET_RETURN_PATH)
|
95 |
$phpmailer->Sender = $phpmailer->From;
|
96 |
-
|
97 |
if (WPMS_MAILER == 'smtp') {
|
98 |
$phpmailer->SMTPSecure = WPMS_SSL;
|
99 |
$phpmailer->Host = WPMS_SMTP_HOST;
|
@@ -104,55 +108,69 @@ function phpmailer_init_smtp($phpmailer) {
|
|
104 |
$phpmailer->Password = WPMS_SMTP_PASS;
|
105 |
}
|
106 |
}
|
107 |
-
|
108 |
// If you're using contstants, set any custom options here
|
109 |
$phpmailer = apply_filters('wp_mail_smtp_custom_options', $phpmailer);
|
110 |
-
|
111 |
}
|
112 |
else {
|
113 |
-
|
114 |
// Check that mailer is not blank, and if mailer=smtp, host is not blank
|
115 |
if ( ! get_option('mailer') || ( get_option('mailer') == 'smtp' && ! get_option('smtp_host') ) ) {
|
116 |
return;
|
117 |
}
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
119 |
// Set the mailer type as per config above, this overrides the already called isMail method
|
120 |
$phpmailer->Mailer = get_option('mailer');
|
121 |
-
|
122 |
// Set the Sender (return-path) if required
|
123 |
if (get_option('mail_set_return_path'))
|
124 |
$phpmailer->Sender = $phpmailer->From;
|
125 |
-
|
126 |
// Set the SMTPSecure value, if set to none, leave this blank
|
127 |
$phpmailer->SMTPSecure = get_option('smtp_ssl') == 'none' ? '' : get_option('smtp_ssl');
|
128 |
-
|
129 |
// If we're sending via SMTP, set the host
|
130 |
if (get_option('mailer') == "smtp") {
|
131 |
-
|
132 |
// Set the SMTPSecure value, if set to none, leave this blank
|
133 |
$phpmailer->SMTPSecure = get_option('smtp_ssl') == 'none' ? '' : get_option('smtp_ssl');
|
134 |
-
|
135 |
// Set the other options
|
136 |
$phpmailer->Host = get_option('smtp_host');
|
137 |
$phpmailer->Port = get_option('smtp_port');
|
138 |
-
|
139 |
// If we're using smtp auth, set the username & password
|
140 |
if (get_option('smtp_auth') == "true") {
|
141 |
$phpmailer->SMTPAuth = TRUE;
|
142 |
$phpmailer->Username = get_option('smtp_user');
|
143 |
$phpmailer->Password = get_option('smtp_pass');
|
144 |
}
|
145 |
-
}
|
146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
// You can add your own options here, see the phpmailer documentation for more info:
|
148 |
// http://phpmailer.sourceforge.net/docs/
|
149 |
$phpmailer = apply_filters('wp_mail_smtp_custom_options', $phpmailer);
|
150 |
-
|
151 |
-
|
152 |
// STOP adding options here.
|
153 |
-
|
154 |
}
|
155 |
-
|
156 |
} // End of phpmailer_init_smtp() function definition
|
157 |
endif;
|
158 |
|
@@ -164,11 +182,11 @@ endif;
|
|
164 |
if (!function_exists('wp_mail_smtp_options_page')) :
|
165 |
// Define the function
|
166 |
function wp_mail_smtp_options_page() {
|
167 |
-
|
168 |
// Load the options
|
169 |
global $wpms_options, $phpmailer;
|
170 |
-
|
171 |
-
// Make sure the PHPMailer class has been instantiated
|
172 |
// (copied verbatim from wp-includes/pluggable.php)
|
173 |
// (Re)create it, if it's gone missing
|
174 |
if ( !is_object( $phpmailer ) || !is_a( $phpmailer, 'PHPMailer' ) ) {
|
@@ -179,30 +197,30 @@ function wp_mail_smtp_options_page() {
|
|
179 |
|
180 |
// Send a test mail if necessary
|
181 |
if (isset($_POST['wpms_action']) && $_POST['wpms_action'] == __('Send Test', 'wp_mail_smtp') && is_email($_POST['to'])) {
|
182 |
-
|
183 |
check_admin_referer('test-email');
|
184 |
-
|
185 |
// Set up the mail variables
|
186 |
$to = $_POST['to'];
|
187 |
$subject = 'WP Mail SMTP: ' . __('Test mail to ', 'wp_mail_smtp') . $to;
|
188 |
$message = __('This is a test email generated by the WP Mail SMTP WordPress plugin.', 'wp_mail_smtp');
|
189 |
-
|
190 |
// Set SMTPDebug to true
|
191 |
$phpmailer->SMTPDebug = true;
|
192 |
-
|
193 |
// Start output buffering to grab smtp debugging output
|
194 |
ob_start();
|
195 |
|
196 |
// Send the test mail
|
197 |
$result = wp_mail($to,$subject,$message);
|
198 |
-
|
199 |
// Strip out the language strings which confuse users
|
200 |
//unset($phpmailer->language);
|
201 |
// This property became protected in WP 3.2
|
202 |
-
|
203 |
// Grab the smtp debugging output
|
204 |
$smtp_debug = ob_get_clean();
|
205 |
-
|
206 |
// Output the response
|
207 |
?>
|
208 |
<div id="message" class="updated fade"><p><strong><?php _e('Test Message Sent', 'wp_mail_smtp'); ?></strong></p>
|
@@ -214,12 +232,12 @@ function wp_mail_smtp_options_page() {
|
|
214 |
<pre><?php echo $smtp_debug ?></pre>
|
215 |
</div>
|
216 |
<?php
|
217 |
-
|
218 |
// Destroy $phpmailer so it doesn't cause issues later
|
219 |
unset($phpmailer);
|
220 |
|
221 |
}
|
222 |
-
|
223 |
?>
|
224 |
<div class="wrap">
|
225 |
<h2><?php _e('Advanced Email Options', 'wp_mail_smtp'); ?></h2>
|
@@ -230,12 +248,14 @@ function wp_mail_smtp_options_page() {
|
|
230 |
<tr valign="top">
|
231 |
<th scope="row"><label for="mail_from"><?php _e('From Email', 'wp_mail_smtp'); ?></label></th>
|
232 |
<td><input name="mail_from" type="text" id="mail_from" value="<?php print(get_option('mail_from')); ?>" size="40" class="regular-text" />
|
233 |
-
<
|
|
|
234 |
</tr>
|
235 |
<tr valign="top">
|
236 |
<th scope="row"><label for="mail_from_name"><?php _e('From Name', 'wp_mail_smtp'); ?></label></th>
|
237 |
<td><input name="mail_from_name" type="text" id="mail_from_name" value="<?php print(get_option('mail_from_name')); ?>" size="40" class="regular-text" />
|
238 |
-
<
|
|
|
239 |
</tr>
|
240 |
</table>
|
241 |
|
@@ -244,11 +264,15 @@ function wp_mail_smtp_options_page() {
|
|
244 |
<tr valign="top">
|
245 |
<th scope="row"><?php _e('Mailer', 'wp_mail_smtp'); ?> </th>
|
246 |
<td><fieldset><legend class="screen-reader-text"><span><?php _e('Mailer', 'wp_mail_smtp'); ?></span></legend>
|
247 |
-
<p><input id="mailer_smtp" type="radio" name="mailer" value="smtp" <?php checked('smtp', get_option('mailer')); ?> />
|
248 |
<label for="mailer_smtp"><?php _e('Send all WordPress emails via SMTP.', 'wp_mail_smtp'); ?></label></p>
|
249 |
-
<p><input id="
|
|
|
|
|
250 |
<label for="mailer_mail"><?php _e('Use the PHP mail() function to send emails.', 'wp_mail_smtp'); ?></label></p>
|
251 |
-
</fieldset
|
|
|
|
|
252 |
</tr>
|
253 |
</table>
|
254 |
|
@@ -263,6 +287,9 @@ function wp_mail_smtp_options_page() {
|
|
263 |
</tr>
|
264 |
</table>
|
265 |
|
|
|
|
|
|
|
266 |
<h3><?php _e('SMTP Options', 'wp_mail_smtp'); ?></h3>
|
267 |
<p><?php _e('These options only apply if you have chosen to send mail by SMTP above.', 'wp_mail_smtp'); ?></p>
|
268 |
|
@@ -277,23 +304,29 @@ function wp_mail_smtp_options_page() {
|
|
277 |
</tr>
|
278 |
<tr valign="top">
|
279 |
<th scope="row"><?php _e('Encryption', 'wp_mail_smtp'); ?> </th>
|
280 |
-
<td
|
|
|
|
|
281 |
<input id="smtp_ssl_none" type="radio" name="smtp_ssl" value="none" <?php checked('none', get_option('smtp_ssl')); ?> />
|
282 |
<label for="smtp_ssl_none"><span><?php _e('No encryption.', 'wp_mail_smtp'); ?></span></label><br />
|
283 |
<input id="smtp_ssl_ssl" type="radio" name="smtp_ssl" value="ssl" <?php checked('ssl', get_option('smtp_ssl')); ?> />
|
284 |
<label for="smtp_ssl_ssl"><span><?php _e('Use SSL encryption.', 'wp_mail_smtp'); ?></span></label><br />
|
285 |
<input id="smtp_ssl_tls" type="radio" name="smtp_ssl" value="tls" <?php checked('tls', get_option('smtp_ssl')); ?> />
|
286 |
-
<label for="smtp_ssl_tls"><span><?php _e('Use TLS encryption.
|
|
|
287 |
</td>
|
288 |
</tr>
|
289 |
<tr valign="top">
|
290 |
<th scope="row"><?php _e('Authentication', 'wp_mail_smtp'); ?> </th>
|
291 |
<td>
|
|
|
|
|
292 |
<input id="smtp_auth_false" type="radio" name="smtp_auth" value="false" <?php checked('false', get_option('smtp_auth')); ?> />
|
293 |
<label for="smtp_auth_false"><span><?php _e('No: Do not use SMTP authentication.', 'wp_mail_smtp'); ?></span></label><br />
|
294 |
<input id="smtp_auth_true" type="radio" name="smtp_auth" value="true" <?php checked('true', get_option('smtp_auth')); ?> />
|
295 |
<label for="smtp_auth_true"><span><?php _e('Yes: Use SMTP authentication.', 'wp_mail_smtp'); ?></span></label><br />
|
296 |
-
<
|
|
|
297 |
</td>
|
298 |
</tr>
|
299 |
<tr valign="top">
|
@@ -302,11 +335,55 @@ function wp_mail_smtp_options_page() {
|
|
302 |
</tr>
|
303 |
<tr valign="top">
|
304 |
<th scope="row"><label for="smtp_pass"><?php _e('Password', 'wp_mail_smtp'); ?></label></th>
|
305 |
-
<td
|
|
|
|
|
|
|
306 |
</tr>
|
307 |
</table>
|
308 |
|
309 |
<p class="submit"><input type="submit" name="submit" id="submit" class="button-primary" value="<?php _e('Save Changes'); ?>" /></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
<input type="hidden" name="action" value="update" />
|
311 |
</p>
|
312 |
<input type="hidden" name="option_page" value="email">
|
@@ -318,17 +395,38 @@ function wp_mail_smtp_options_page() {
|
|
318 |
<?php wp_nonce_field('test-email'); ?>
|
319 |
<table class="optiontable form-table">
|
320 |
<tr valign="top">
|
321 |
-
<th scope="row"><label for="to"><?php _e('To
|
322 |
<td><input name="to" type="text" id="to" value="" size="40" class="code" />
|
323 |
-
<
|
|
|
324 |
</tr>
|
325 |
</table>
|
326 |
<p class="submit"><input type="submit" name="wpms_action" id="wpms_action" class="button-primary" value="<?php _e('Send Test', 'wp_mail_smtp'); ?>" /></p>
|
327 |
</form>
|
328 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
</div>
|
330 |
<?php
|
331 |
-
|
332 |
} // End of wp_mail_smtp_options_page() function definition
|
333 |
endif;
|
334 |
|
@@ -338,11 +436,11 @@ endif;
|
|
338 |
*/
|
339 |
if (!function_exists('wp_mail_smtp_menus')) :
|
340 |
function wp_mail_smtp_menus() {
|
341 |
-
|
342 |
if (function_exists('add_submenu_page')) {
|
343 |
add_options_page(__('Advanced Email Options', 'wp_mail_smtp'),__('Email', 'wp_mail_smtp'),'manage_options',__FILE__,'wp_mail_smtp_options_page');
|
344 |
}
|
345 |
-
|
346 |
} // End of wp_mail_smtp_menus() function definition
|
347 |
endif;
|
348 |
|
@@ -352,10 +450,10 @@ endif;
|
|
352 |
*/
|
353 |
if (!function_exists('wp_mail_smtp_mail_from')) :
|
354 |
function wp_mail_smtp_mail_from ($orig) {
|
355 |
-
|
356 |
// This is copied from pluggable.php lines 348-354 as at revision 10150
|
357 |
// http://trac.wordpress.org/browser/branches/2.7/wp-includes/pluggable.php#L348
|
358 |
-
|
359 |
// Get the site domain and get rid of www.
|
360 |
$sitename = strtolower( $_SERVER['SERVER_NAME'] );
|
361 |
if ( substr( $sitename, 0, 4 ) == 'www.' ) {
|
@@ -364,22 +462,22 @@ function wp_mail_smtp_mail_from ($orig) {
|
|
364 |
|
365 |
$default_from = 'wordpress@' . $sitename;
|
366 |
// End of copied code
|
367 |
-
|
368 |
// If the from email is not the default, return it unchanged
|
369 |
if ( $orig != $default_from ) {
|
370 |
return $orig;
|
371 |
}
|
372 |
-
|
373 |
if (defined('WPMS_ON') && WPMS_ON) {
|
374 |
if (defined('WPMS_MAIL_FROM') && WPMS_MAIL_FROM != false)
|
375 |
return WPMS_MAIL_FROM;
|
376 |
}
|
377 |
elseif (is_email(get_option('mail_from'), false))
|
378 |
return get_option('mail_from');
|
379 |
-
|
380 |
// If in doubt, return the original value
|
381 |
return $orig;
|
382 |
-
|
383 |
} // End of wp_mail_smtp_mail_from() function definition
|
384 |
endif;
|
385 |
|
@@ -389,7 +487,7 @@ endif;
|
|
389 |
*/
|
390 |
if (!function_exists('wp_mail_smtp_mail_from_name')) :
|
391 |
function wp_mail_smtp_mail_from_name ($orig) {
|
392 |
-
|
393 |
// Only filter if the from name is the default
|
394 |
if ($orig == 'WordPress') {
|
395 |
if (defined('WPMS_ON') && WPMS_ON) {
|
@@ -399,10 +497,10 @@ function wp_mail_smtp_mail_from_name ($orig) {
|
|
399 |
elseif ( get_option('mail_from_name') != "" && is_string(get_option('mail_from_name')) )
|
400 |
return get_option('mail_from_name');
|
401 |
}
|
402 |
-
|
403 |
// If in doubt, return the original value
|
404 |
return $orig;
|
405 |
-
|
406 |
} // End of wp_mail_smtp_mail_from_name() function definition
|
407 |
endif;
|
408 |
|
17 |
|
18 |
/**
|
19 |
* Setting options in wp-config.php
|
20 |
+
*
|
21 |
* Specifically aimed at WPMU users, you can set the options for this plugin as
|
22 |
* constants in wp-config.php. This disables the plugin's admin page and may
|
23 |
* improve performance very slightly. Copy the code below into wp-config.php.
|
48 |
'smtp_ssl' => 'none',
|
49 |
'smtp_auth' => false,
|
50 |
'smtp_user' => '',
|
51 |
+
'smtp_pass' => '',
|
52 |
+
'pepipost_user' => '',
|
53 |
+
'pepipost_pass' => '',
|
54 |
+
'pepipost_port' => '2525',
|
55 |
+
'pepipost_ssl' => 'none'
|
56 |
);
|
57 |
|
58 |
|
61 |
*/
|
62 |
if (!function_exists('wp_mail_smtp_activate')) :
|
63 |
function wp_mail_smtp_activate() {
|
64 |
+
|
65 |
global $wpms_options;
|
66 |
+
|
67 |
// Create the required options...
|
68 |
foreach ($wpms_options as $name => $val) {
|
69 |
add_option($name,$val);
|
70 |
}
|
71 |
+
|
72 |
}
|
73 |
endif;
|
74 |
|
75 |
if (!function_exists('wp_mail_smtp_whitelist_options')) :
|
76 |
function wp_mail_smtp_whitelist_options($whitelist_options) {
|
77 |
+
|
78 |
global $wpms_options;
|
79 |
+
|
80 |
// Add our options to the array
|
81 |
$whitelist_options['email'] = array_keys($wpms_options);
|
82 |
+
|
83 |
return $whitelist_options;
|
84 |
+
|
85 |
}
|
86 |
endif;
|
87 |
|
89 |
if (!function_exists('phpmailer_init_smtp')) :
|
90 |
// This code is copied, from wp-includes/pluggable.php as at version 2.2.2
|
91 |
function phpmailer_init_smtp($phpmailer) {
|
92 |
+
|
93 |
// If constants are defined, apply those options
|
94 |
if (defined('WPMS_ON') && WPMS_ON) {
|
95 |
+
|
96 |
$phpmailer->Mailer = WPMS_MAILER;
|
97 |
+
|
98 |
if (WPMS_SET_RETURN_PATH)
|
99 |
$phpmailer->Sender = $phpmailer->From;
|
100 |
+
|
101 |
if (WPMS_MAILER == 'smtp') {
|
102 |
$phpmailer->SMTPSecure = WPMS_SSL;
|
103 |
$phpmailer->Host = WPMS_SMTP_HOST;
|
108 |
$phpmailer->Password = WPMS_SMTP_PASS;
|
109 |
}
|
110 |
}
|
111 |
+
|
112 |
// If you're using contstants, set any custom options here
|
113 |
$phpmailer = apply_filters('wp_mail_smtp_custom_options', $phpmailer);
|
114 |
+
|
115 |
}
|
116 |
else {
|
117 |
+
|
118 |
// Check that mailer is not blank, and if mailer=smtp, host is not blank
|
119 |
if ( ! get_option('mailer') || ( get_option('mailer') == 'smtp' && ! get_option('smtp_host') ) ) {
|
120 |
return;
|
121 |
}
|
122 |
+
|
123 |
+
// If the mailer is pepipost, make sure we have a username and password
|
124 |
+
if (get_option('mailer') == 'pepipost' && (! get_option('pepipost_user') && ! get_option('pepipost_pass'))) {
|
125 |
+
return;
|
126 |
+
}
|
127 |
+
|
128 |
// Set the mailer type as per config above, this overrides the already called isMail method
|
129 |
$phpmailer->Mailer = get_option('mailer');
|
130 |
+
|
131 |
// Set the Sender (return-path) if required
|
132 |
if (get_option('mail_set_return_path'))
|
133 |
$phpmailer->Sender = $phpmailer->From;
|
134 |
+
|
135 |
// Set the SMTPSecure value, if set to none, leave this blank
|
136 |
$phpmailer->SMTPSecure = get_option('smtp_ssl') == 'none' ? '' : get_option('smtp_ssl');
|
137 |
+
|
138 |
// If we're sending via SMTP, set the host
|
139 |
if (get_option('mailer') == "smtp") {
|
140 |
+
|
141 |
// Set the SMTPSecure value, if set to none, leave this blank
|
142 |
$phpmailer->SMTPSecure = get_option('smtp_ssl') == 'none' ? '' : get_option('smtp_ssl');
|
143 |
+
|
144 |
// Set the other options
|
145 |
$phpmailer->Host = get_option('smtp_host');
|
146 |
$phpmailer->Port = get_option('smtp_port');
|
147 |
+
|
148 |
// If we're using smtp auth, set the username & password
|
149 |
if (get_option('smtp_auth') == "true") {
|
150 |
$phpmailer->SMTPAuth = TRUE;
|
151 |
$phpmailer->Username = get_option('smtp_user');
|
152 |
$phpmailer->Password = get_option('smtp_pass');
|
153 |
}
|
154 |
+
} elseif (get_option('mailer') == 'pepipost') {
|
155 |
+
// Set the Pepipost settings
|
156 |
+
$phpmailer->Mailer = 'smtp';
|
157 |
+
$phpmailer->Host = 'smtp.pepipost.com';
|
158 |
+
$phpmailer->Port = get_option('pepipost_port');
|
159 |
+
$phpmailer->SMTPSecure = get_option('pepipost_ssl') == 'none' ? '' : get_option('pepipost_ssl');;
|
160 |
+
$phpmailer->SMTPAuth = TRUE;
|
161 |
+
$phpmailer->Username = get_option('pepipost_user');
|
162 |
+
$phpmailer->Password = get_option('pepipost_pass');
|
163 |
+
}
|
164 |
+
|
165 |
// You can add your own options here, see the phpmailer documentation for more info:
|
166 |
// http://phpmailer.sourceforge.net/docs/
|
167 |
$phpmailer = apply_filters('wp_mail_smtp_custom_options', $phpmailer);
|
168 |
+
|
169 |
+
|
170 |
// STOP adding options here.
|
171 |
+
|
172 |
}
|
173 |
+
|
174 |
} // End of phpmailer_init_smtp() function definition
|
175 |
endif;
|
176 |
|
182 |
if (!function_exists('wp_mail_smtp_options_page')) :
|
183 |
// Define the function
|
184 |
function wp_mail_smtp_options_page() {
|
185 |
+
|
186 |
// Load the options
|
187 |
global $wpms_options, $phpmailer;
|
188 |
+
|
189 |
+
// Make sure the PHPMailer class has been instantiated
|
190 |
// (copied verbatim from wp-includes/pluggable.php)
|
191 |
// (Re)create it, if it's gone missing
|
192 |
if ( !is_object( $phpmailer ) || !is_a( $phpmailer, 'PHPMailer' ) ) {
|
197 |
|
198 |
// Send a test mail if necessary
|
199 |
if (isset($_POST['wpms_action']) && $_POST['wpms_action'] == __('Send Test', 'wp_mail_smtp') && is_email($_POST['to'])) {
|
200 |
+
|
201 |
check_admin_referer('test-email');
|
202 |
+
|
203 |
// Set up the mail variables
|
204 |
$to = $_POST['to'];
|
205 |
$subject = 'WP Mail SMTP: ' . __('Test mail to ', 'wp_mail_smtp') . $to;
|
206 |
$message = __('This is a test email generated by the WP Mail SMTP WordPress plugin.', 'wp_mail_smtp');
|
207 |
+
|
208 |
// Set SMTPDebug to true
|
209 |
$phpmailer->SMTPDebug = true;
|
210 |
+
|
211 |
// Start output buffering to grab smtp debugging output
|
212 |
ob_start();
|
213 |
|
214 |
// Send the test mail
|
215 |
$result = wp_mail($to,$subject,$message);
|
216 |
+
|
217 |
// Strip out the language strings which confuse users
|
218 |
//unset($phpmailer->language);
|
219 |
// This property became protected in WP 3.2
|
220 |
+
|
221 |
// Grab the smtp debugging output
|
222 |
$smtp_debug = ob_get_clean();
|
223 |
+
|
224 |
// Output the response
|
225 |
?>
|
226 |
<div id="message" class="updated fade"><p><strong><?php _e('Test Message Sent', 'wp_mail_smtp'); ?></strong></p>
|
232 |
<pre><?php echo $smtp_debug ?></pre>
|
233 |
</div>
|
234 |
<?php
|
235 |
+
|
236 |
// Destroy $phpmailer so it doesn't cause issues later
|
237 |
unset($phpmailer);
|
238 |
|
239 |
}
|
240 |
+
|
241 |
?>
|
242 |
<div class="wrap">
|
243 |
<h2><?php _e('Advanced Email Options', 'wp_mail_smtp'); ?></h2>
|
248 |
<tr valign="top">
|
249 |
<th scope="row"><label for="mail_from"><?php _e('From Email', 'wp_mail_smtp'); ?></label></th>
|
250 |
<td><input name="mail_from" type="text" id="mail_from" value="<?php print(get_option('mail_from')); ?>" size="40" class="regular-text" />
|
251 |
+
<p class="description"><?php _e('You can specify the email address that emails should be sent from. If you leave this blank, the default email will be used.', 'wp_mail_smtp'); if(get_option('db_version') < 6124) { print('<br /><span style="color: red;">'); _e('<strong>Please Note:</strong> You appear to be using a version of WordPress prior to 2.3. Please ignore the From Name field and instead enter Name<email@domain.com> in this field.', 'wp_mail_smtp'); print('</span>'); } ?></p>
|
252 |
+
</td>
|
253 |
</tr>
|
254 |
<tr valign="top">
|
255 |
<th scope="row"><label for="mail_from_name"><?php _e('From Name', 'wp_mail_smtp'); ?></label></th>
|
256 |
<td><input name="mail_from_name" type="text" id="mail_from_name" value="<?php print(get_option('mail_from_name')); ?>" size="40" class="regular-text" />
|
257 |
+
<p class="description"><?php _e('You can specify the name that emails should be sent from. If you leave this blank, the emails will be sent from WordPress.', 'wp_mail_smtp'); ?></p>
|
258 |
+
</td>
|
259 |
</tr>
|
260 |
</table>
|
261 |
|
264 |
<tr valign="top">
|
265 |
<th scope="row"><?php _e('Mailer', 'wp_mail_smtp'); ?> </th>
|
266 |
<td><fieldset><legend class="screen-reader-text"><span><?php _e('Mailer', 'wp_mail_smtp'); ?></span></legend>
|
267 |
+
<p><input id="mailer_smtp" class="wpms_mailer" type="radio" name="mailer" value="smtp" <?php checked('smtp', get_option('mailer')); ?> />
|
268 |
<label for="mailer_smtp"><?php _e('Send all WordPress emails via SMTP.', 'wp_mail_smtp'); ?></label></p>
|
269 |
+
<p><input id="mailer_pepipost" class="wpms_mailer" type="radio" name="mailer" value="pepipost" <?php checked('pepipost', get_option('mailer')); ?> />
|
270 |
+
<label for="mailer_pepipost"><?php _e('Use Pepipost SMTP to send emails.', 'wp_mail_smtp'); ?></label></p>
|
271 |
+
<p><input id="mailer_mail" class="wpms_mailer" type="radio" name="mailer" value="mail" <?php checked('mail', get_option('mailer')); ?> />
|
272 |
<label for="mailer_mail"><?php _e('Use the PHP mail() function to send emails.', 'wp_mail_smtp'); ?></label></p>
|
273 |
+
</fieldset>
|
274 |
+
<p class="description">Looking for high inbox delivery? Try Pepipost with easy setup and free emails. Learn more <a href="https://app1.pepipost.com/index.php/login/wp_mail_smtp?page=signup&utm_source=WordPress&utm_campaign=Plugins&utm_medium=wp_mail_smtp&utm_term=organic&code=WP-MAIL-SMTP" target="_blank">here</a>.</p>
|
275 |
+
</td>
|
276 |
</tr>
|
277 |
</table>
|
278 |
|
287 |
</tr>
|
288 |
</table>
|
289 |
|
290 |
+
<p class="submit"><input type="submit" name="submit" id="submit" class="button-primary" value="<?php _e('Save Changes'); ?>" /></p>
|
291 |
+
|
292 |
+
<div id="wpms_section_smtp" class="wpms_section">
|
293 |
<h3><?php _e('SMTP Options', 'wp_mail_smtp'); ?></h3>
|
294 |
<p><?php _e('These options only apply if you have chosen to send mail by SMTP above.', 'wp_mail_smtp'); ?></p>
|
295 |
|
304 |
</tr>
|
305 |
<tr valign="top">
|
306 |
<th scope="row"><?php _e('Encryption', 'wp_mail_smtp'); ?> </th>
|
307 |
+
<td>
|
308 |
+
<fieldset>
|
309 |
+
<legend class="screen-reader-text"><span><?php _e('Encryption', 'wp_mail_smtp'); ?></span></legend>
|
310 |
<input id="smtp_ssl_none" type="radio" name="smtp_ssl" value="none" <?php checked('none', get_option('smtp_ssl')); ?> />
|
311 |
<label for="smtp_ssl_none"><span><?php _e('No encryption.', 'wp_mail_smtp'); ?></span></label><br />
|
312 |
<input id="smtp_ssl_ssl" type="radio" name="smtp_ssl" value="ssl" <?php checked('ssl', get_option('smtp_ssl')); ?> />
|
313 |
<label for="smtp_ssl_ssl"><span><?php _e('Use SSL encryption.', 'wp_mail_smtp'); ?></span></label><br />
|
314 |
<input id="smtp_ssl_tls" type="radio" name="smtp_ssl" value="tls" <?php checked('tls', get_option('smtp_ssl')); ?> />
|
315 |
+
<label for="smtp_ssl_tls"><span><?php _e('Use TLS encryption.', 'wp_mail_smtp'); ?></span></label>
|
316 |
+
<p class="description"><?php esc_html_e('TLS is not the same as STARTTLS. For most servers SSL is the recommended option.'); ?></p>
|
317 |
</td>
|
318 |
</tr>
|
319 |
<tr valign="top">
|
320 |
<th scope="row"><?php _e('Authentication', 'wp_mail_smtp'); ?> </th>
|
321 |
<td>
|
322 |
+
<fieldset>
|
323 |
+
<legend class="screen-reader-text"><span><?php _e('Authentication', 'wp_mail_smtp'); ?></span></legend>
|
324 |
<input id="smtp_auth_false" type="radio" name="smtp_auth" value="false" <?php checked('false', get_option('smtp_auth')); ?> />
|
325 |
<label for="smtp_auth_false"><span><?php _e('No: Do not use SMTP authentication.', 'wp_mail_smtp'); ?></span></label><br />
|
326 |
<input id="smtp_auth_true" type="radio" name="smtp_auth" value="true" <?php checked('true', get_option('smtp_auth')); ?> />
|
327 |
<label for="smtp_auth_true"><span><?php _e('Yes: Use SMTP authentication.', 'wp_mail_smtp'); ?></span></label><br />
|
328 |
+
<p class="description"><?php _e('If this is set to no, the values below are ignored.', 'wp_mail_smtp'); ?></p>
|
329 |
+
</fieldset>
|
330 |
</td>
|
331 |
</tr>
|
332 |
<tr valign="top">
|
335 |
</tr>
|
336 |
<tr valign="top">
|
337 |
<th scope="row"><label for="smtp_pass"><?php _e('Password', 'wp_mail_smtp'); ?></label></th>
|
338 |
+
<td>
|
339 |
+
<input name="smtp_pass" type="text" id="smtp_pass" value="<?php print(get_option('smtp_pass')); ?>" size="40" class="code" />
|
340 |
+
<p class="description"><?php printf(esc_html__('This is in plain text because it must be stored encrypted. For more information, click %1$shere%2$s'), '<a href="">', '</a>'); ?>.</p>
|
341 |
+
</td>
|
342 |
</tr>
|
343 |
</table>
|
344 |
|
345 |
<p class="submit"><input type="submit" name="submit" id="submit" class="button-primary" value="<?php _e('Save Changes'); ?>" /></p>
|
346 |
+
</div><!-- #wpms_section_smtp -->
|
347 |
+
|
348 |
+
<div id="wpms_section_pepipost" class="wpms_section">
|
349 |
+
<h3><?php _e('Pepipost SMTP Options', 'wp_mail_smtp'); ?></h3>
|
350 |
+
<p>You need to signup on <a href="https://app1.pepipost.com/index.php/login/wp_mail_smtp?page=signup&utm_source=WordPress&utm_campaign=Plugins&utm_medium=wp_mail_smtp&utm_term=organic&code=WP-MAIL-SMTP" target="_blank">Pepipost</a> to get the SMTP username/password. Refer this <a href="http://support.pepipost.com/knowledge_base/topics/wp-mail-smtp?utm_source=WordPress&utm_campaign=Plugins&utm_medium=wp_mail_smtp&utm_term=organic" target="_blank">doc</a> for more help.</p>
|
351 |
+
<table class="optiontable form-table">
|
352 |
+
<tr valign="top">
|
353 |
+
<th scope="row"><label for="pepipost_user"><?php _e('Username', 'wp_mail_smtp'); ?></label></th>
|
354 |
+
<td><input name="pepipost_user" type="text" id="pepipost_user" value="<?php print(get_option('pepipost_user')); ?>" size="40" class="code" /></td>
|
355 |
+
</tr>
|
356 |
+
<tr valign="top">
|
357 |
+
<th scope="row"><label for="pepipost_pass"><?php _e('Password', 'wp_mail_smtp'); ?></label></th>
|
358 |
+
<td><input name="pepipost_pass" type="text" id="pepipost_pass" value="<?php print(get_option('pepipost_pass')); ?>" size="40" class="code" /></td>
|
359 |
+
</tr>
|
360 |
+
<tr valign="top">
|
361 |
+
<th scope="row"><label for="pepipost_port"><?php _e('SMTP Port', 'wp_mail_smtp'); ?></label></th>
|
362 |
+
<td><input name="pepipost_port" type="text" id="pepipost_port" value="<?php print(get_option('pepipost_port')); ?>" size="6" class="regular-text" /></td>
|
363 |
+
</tr>
|
364 |
+
<tr valign="top">
|
365 |
+
<th scope="row"><?php _e('Encryption', 'wp_mail_smtp'); ?> </th>
|
366 |
+
<td>
|
367 |
+
<fieldset>
|
368 |
+
<legend class="screen-reader-text">
|
369 |
+
<span>
|
370 |
+
<?php _e('Encryption', 'wp_mail_smtp'); ?>
|
371 |
+
</span>
|
372 |
+
</legend>
|
373 |
+
<input id="pepipost_ssl_none" type="radio" name="pepipost_ssl" value="none" <?php checked('none', get_option('pepipost_ssl')); ?> />
|
374 |
+
<label for="pepipost_ssl_none"><span><?php _e('No encryption.', 'wp_mail_smtp'); ?></span></label><br />
|
375 |
+
<input id="pepipost_ssl_ssl" type="radio" name="pepipost_ssl" value="ssl" <?php checked('ssl', get_option('pepipost_ssl')); ?> />
|
376 |
+
<label for="pepipost_ssl_ssl"><span><?php _e('Use SSL encryption.', 'wp_mail_smtp'); ?></span></label><br />
|
377 |
+
<input id="pepipost_ssl_tls" type="radio" name="pepipost_ssl" value="tls" <?php checked('tls', get_option('pepipost_ssl')); ?> />
|
378 |
+
<label for="pepipost_ssl_tls"><span><?php _e('Use TLS encryption.', 'wp_mail_smtp'); ?></span></label>
|
379 |
+
</td>
|
380 |
+
</tr>
|
381 |
+
</table>
|
382 |
+
|
383 |
+
<p class="submit"><input type="submit" name="submit" id="submit" class="button-primary" value="<?php _e('Save Changes'); ?>" /></p>
|
384 |
+
</div><!-- #wpms_section_pepipost -->
|
385 |
+
|
386 |
+
|
387 |
<input type="hidden" name="action" value="update" />
|
388 |
</p>
|
389 |
<input type="hidden" name="option_page" value="email">
|
395 |
<?php wp_nonce_field('test-email'); ?>
|
396 |
<table class="optiontable form-table">
|
397 |
<tr valign="top">
|
398 |
+
<th scope="row"><label for="to"><?php _e('To', 'wp_mail_smtp'); ?></label></th>
|
399 |
<td><input name="to" type="text" id="to" value="" size="40" class="code" />
|
400 |
+
<p class="description"><?php _e('Type an email address here and then click Send Test to generate a test email.', 'wp_mail_smtp'); ?></p>
|
401 |
+
</td>
|
402 |
</tr>
|
403 |
</table>
|
404 |
<p class="submit"><input type="submit" name="wpms_action" id="wpms_action" class="button-primary" value="<?php _e('Send Test', 'wp_mail_smtp'); ?>" /></p>
|
405 |
</form>
|
406 |
|
407 |
+
<script type="text/javascript">
|
408 |
+
var wpmsOnMailerChange = function(mailer) {
|
409 |
+
// Hide all the mailer forms
|
410 |
+
jQuery('.wpms_section').hide()
|
411 |
+
// Show the target mailer form
|
412 |
+
jQuery('#wpms_section_' + mailer).show()
|
413 |
+
}
|
414 |
+
jQuery(document).ready(function(){
|
415 |
+
// Call wpmsOnMailerChange() on startup with the current mailer
|
416 |
+
wpmsOnMailerChange(jQuery('input.wpms_mailer:checked').val())
|
417 |
+
|
418 |
+
// Watch the mailer for any changes
|
419 |
+
jQuery('input.wpms_mailer').on('change', function(e) {
|
420 |
+
// Call the wpmsOnMailerChange() handler, passing the value of the newly
|
421 |
+
// selected mailer
|
422 |
+
wpmsOnMailerChange(jQuery(e.target).val())
|
423 |
+
})
|
424 |
+
})
|
425 |
+
</script>
|
426 |
+
|
427 |
</div>
|
428 |
<?php
|
429 |
+
|
430 |
} // End of wp_mail_smtp_options_page() function definition
|
431 |
endif;
|
432 |
|
436 |
*/
|
437 |
if (!function_exists('wp_mail_smtp_menus')) :
|
438 |
function wp_mail_smtp_menus() {
|
439 |
+
|
440 |
if (function_exists('add_submenu_page')) {
|
441 |
add_options_page(__('Advanced Email Options', 'wp_mail_smtp'),__('Email', 'wp_mail_smtp'),'manage_options',__FILE__,'wp_mail_smtp_options_page');
|
442 |
}
|
443 |
+
|
444 |
} // End of wp_mail_smtp_menus() function definition
|
445 |
endif;
|
446 |
|
450 |
*/
|
451 |
if (!function_exists('wp_mail_smtp_mail_from')) :
|
452 |
function wp_mail_smtp_mail_from ($orig) {
|
453 |
+
|
454 |
// This is copied from pluggable.php lines 348-354 as at revision 10150
|
455 |
// http://trac.wordpress.org/browser/branches/2.7/wp-includes/pluggable.php#L348
|
456 |
+
|
457 |
// Get the site domain and get rid of www.
|
458 |
$sitename = strtolower( $_SERVER['SERVER_NAME'] );
|
459 |
if ( substr( $sitename, 0, 4 ) == 'www.' ) {
|
462 |
|
463 |
$default_from = 'wordpress@' . $sitename;
|
464 |
// End of copied code
|
465 |
+
|
466 |
// If the from email is not the default, return it unchanged
|
467 |
if ( $orig != $default_from ) {
|
468 |
return $orig;
|
469 |
}
|
470 |
+
|
471 |
if (defined('WPMS_ON') && WPMS_ON) {
|
472 |
if (defined('WPMS_MAIL_FROM') && WPMS_MAIL_FROM != false)
|
473 |
return WPMS_MAIL_FROM;
|
474 |
}
|
475 |
elseif (is_email(get_option('mail_from'), false))
|
476 |
return get_option('mail_from');
|
477 |
+
|
478 |
// If in doubt, return the original value
|
479 |
return $orig;
|
480 |
+
|
481 |
} // End of wp_mail_smtp_mail_from() function definition
|
482 |
endif;
|
483 |
|
487 |
*/
|
488 |
if (!function_exists('wp_mail_smtp_mail_from_name')) :
|
489 |
function wp_mail_smtp_mail_from_name ($orig) {
|
490 |
+
|
491 |
// Only filter if the from name is the default
|
492 |
if ($orig == 'WordPress') {
|
493 |
if (defined('WPMS_ON') && WPMS_ON) {
|
497 |
elseif ( get_option('mail_from_name') != "" && is_string(get_option('mail_from_name')) )
|
498 |
return get_option('mail_from_name');
|
499 |
}
|
500 |
+
|
501 |
// If in doubt, return the original value
|
502 |
return $orig;
|
503 |
+
|
504 |
} // End of wp_mail_smtp_mail_from_name() function definition
|
505 |
endif;
|
506 |
|