WP Mail SMTP by WPForms - Version 0.8.3

Version Description

  • Bugfix, return WPMS_MAIL_FROM_NAME, props nacin.
Download this release

Release Info

Developer chmac
Plugin Icon 128x128 WP Mail SMTP by WPForms
Version 0.8.3
Comparing to
See all releases

Code changes from version 0.8 to 0.8.3

Files changed (2) hide show
  1. readme.txt +60 -2
  2. wp_mail_smtp.php +69 -51
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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: 2.7
7
- Stable tag: 0.8
8
 
9
  Reconfigures the wp_mail() function to use SMTP instead of mail() and creates an options page to manage the settings.
10
 
@@ -59,6 +59,64 @@ By all means please contact me to discuss features or options you'd like to see
59
 
60
  1. Screenshot of the Options > Email panel.
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  == Support Questions ==
63
 
64
  If you have support questions not covered in this readme, you can contact me here:
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: 2.9.2
7
+ Stable tag: 0.8.3
8
 
9
  Reconfigures the wp_mail() function to use SMTP instead of mail() and creates an options page to manage the settings.
10
 
59
 
60
  1. Screenshot of the Options > Email panel.
61
 
62
+ == Changelog ==
63
+
64
+ = 0.8.3 =
65
+ * Bugfix, return WPMS_MAIL_FROM_NAME, props nacin.
66
+
67
+ = 0.8.2 =
68
+ * Bugfix, call phpmailer_init_smtp() correctly, props Sinklar.
69
+
70
+ = 0.8.1 =
71
+ * Internationalisation improvements.
72
+
73
+ = 0.8 =
74
+ * Added port, SSL/TLS, option whitelisting, validate_email(), and constant options.
75
+
76
+ = 0.7 =
77
+ * Added checks to only override the default from name / email
78
+
79
+ = 0.6 =
80
+ * Added additional SMTP debugging output
81
+
82
+ = 0.5.2 =
83
+ * Fixed a pre 2.3 bug to do with mail from
84
+
85
+ = 0.5.1 =
86
+ * Added a check to display a warning on versions prior to 2.3
87
+
88
+ = 0.5.0 =
89
+ * Upgraded to match 2.3 filters which add a second filter for from name
90
+
91
+ = 0.4.2 =
92
+ * Fixed a bug in 0.4.1 and added more debugging output
93
+
94
+ = 0.4.1 =
95
+ * Added $phpmailer->ErroInfo to the test mail output
96
+
97
+ = 0.4 =
98
+ * Added the test email feature and cleaned up some other bits and pieces
99
+
100
+ = 0.3.2 =
101
+ * Changed to use register_activation_hook for greater compatability
102
+
103
+ = 0.3.1 =
104
+ * Added readme for WP-Plugins.org compatability
105
+
106
+ = 0.3 =
107
+ * Various bugfixes and added From options
108
+
109
+ = 0.2 =
110
+ * Reworked approach as suggested by westi, added options page
111
+
112
+ = 0.1 =
113
+ * Initial approach, copying the wp_mail function and replacing it
114
+
115
+ == Upgrade Notice ==
116
+
117
+ = 0.8.3 =
118
+ Minor bugfix for users using constants. Very low priority upgrade.
119
+
120
  == Support Questions ==
121
 
122
  If you have support questions not covered in this readme, you can contact me here:
wp_mail_smtp.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: WP-Mail-SMTP
4
- Version: 0.8
5
  Plugin URI: http://www.callum-macdonald.com/code/wp-mail-smtp/
6
  Description: Reconfigures the wp_mail() function to use SMTP instead of mail() and creates an options page to manage the settings.
7
  Author: Callum Macdonald
@@ -36,12 +36,11 @@ define('WPMS_SMTP_PASS', 'password'); // SMTP authentication password, only used
36
  */
37
 
38
  /**
39
- * TODO
40
- *
41
- * + Add WPMU compatability options (hardcode values, disable admin page)
42
- *
43
  * CHANGELOG
44
  *
 
 
 
45
  * 0.8 - Added port, SSL/TLS, option whitelisting, validate_email(), and constant options.
46
  * 0.7 - Added checks to only override the default from name / email
47
  * 0.6 - Added additional SMTP debugging output
@@ -190,19 +189,19 @@ function wp_mail_smtp_options_page() {
190
  }
191
 
192
  // Send a test mail if necessary
193
- if (isset($_POST['wpms_action']) && $_POST['wpms_action'] == __('Send Test') && isset($_POST['to'])) {
194
 
195
  // Set up the mail variables
196
  $to = $_POST['to'];
197
- $subject = "WP Mail SMTP: Test mail to " . $to;
198
- $message = "This is a test email generated by the WP Mail SMTP WordPress plugin.";
199
 
200
  // Set SMTPDebug to level 2
201
  $phpmailer->SMTPDebug = 2;
202
 
203
  // Start output buffering to grab smtp debugging output
204
  ob_start();
205
-
206
  // Send the test mail
207
  $result = wp_mail($to,$subject,$message);
208
 
@@ -211,97 +210,97 @@ function wp_mail_smtp_options_page() {
211
 
212
  // Output the response
213
  ?>
214
- <div id="message" class="updated fade"><p><strong><?php _e('Test Message Sent'); ?></strong></p>
215
- <p><?php _e('The result was:'); ?></p>
216
  <pre><?php var_dump($result); ?></pre>
217
  <?php if ($result != true) { ?>
218
- <p><?php _e('The full debugging output is shown below:'); ?></p>
219
  <pre><?php var_dump($phpmailer); ?></pre>
220
  <?php } ?>
221
- <p><?php _e('The SMTP debugging output is shown below:'); ?></p>
222
  <pre><?php echo $smtp_debug ?></pre>
223
  </div>
224
  <?php
225
-
226
  }
227
 
228
  ?>
229
  <div class="wrap">
230
- <h2><?php _e('Advanced Email Options'); ?></h2>
231
  <form method="post" action="options.php">
232
  <?php wp_nonce_field('email-options'); ?>
233
- <p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;'); ?>" />
234
  <fieldset class="options">
235
- <legend><?php _e('From'); ?></legend>
236
  <table class="optiontable">
237
  <tr valign="top">
238
- <th scope="row"><?php _e('From Email:'); ?> </th>
239
  <td><p><input name="mail_from" type="text" id="mail_from" value="<?php print(get_option('mail_from')); ?>" size="40" class="code" /><br />
240
- <?php _e('You can specify the email address that emails should be sent from. If you leave this blank, the admin email will be used.'); 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&lt;email@domain.com&gt; in this field.'); print('</span>'); } ?></p></td>
241
  </tr>
242
  <tr valign="top">
243
- <th scope="row"><?php _e('From Name:'); ?> </th>
244
  <td><p><input name="mail_from_name" type="text" id="mail_from_name" value="<?php print(get_option('mail_from_name')); ?>" size="40" class="code" /><br />
245
- <?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.'); ?></p></td>
246
  </tr>
247
  </table>
248
 
249
- <legend><?php _e('Mailer'); ?></legend>
250
  <table class="optiontable">
251
  <tr valign="top">
252
- <th scope="row"><?php _e('Mailer:'); ?> </th>
253
  <td>
254
  <p><input id="mailer_smtp" type="radio" name="mailer" value="smtp" <?php checked('smtp', get_option('mailer')); ?> />
255
- <label for="mailer_smtp"><?php _e('Send all WordPress emails via SMTP.'); ?></label></p>
256
  <p><input id="mailer_mail" type="radio" name="mailer" value="mail" <?php checked('mail', get_option('mailer')); ?> />
257
- <label for="mailer_mail"><?php _e('Use the PHP mail() function to send emails.'); ?></label></p>
258
  </td>
259
  </tr>
260
  </table>
261
 
262
- <legend><?php _e('SMTP Options'); ?></legend>
263
- <p><?php _e('These options only apply if you have chosen to send mail by SMTP above.'); ?></p>
264
  <table class="optiontable">
265
  <tr valign="top">
266
- <th scope="row"><?php _e('SMTP Host:'); ?> </th>
267
  <td><input name="smtp_host" type="text" id="smtp_host" value="<?php print(get_option('smtp_host')); ?>" size="40" class="code" /></td>
268
  </tr>
269
  <tr valign="top">
270
- <th scope="row"><?php _e('SMTP Port:'); ?> </th>
271
  <td><input name="smtp_port" type="text" id="smtp_port" value="<?php print(get_option('smtp_port')); ?>" size="6" class="code" /></td>
272
  </tr>
273
  <tr valign="top">
274
- <th scope="row"><?php _e('Encryption:'); ?> </th>
275
  <td>
276
  <p><input id="smtp_ssl_none" type="radio" name="smtp_ssl" value="none" <?php checked('none', get_option('smtp_ssl')); ?> />
277
- <label for="smtp_ssl_none"><?php _e('No encryption.'); ?></label></p>
278
  <p><input id="smtp_ssl_ssl" type="radio" name="smtp_ssl" value="ssl" <?php checked('ssl', get_option('smtp_ssl')); ?> />
279
- <label for="smtp_ssl_ssl"><?php _e('Use SSL encryption.'); ?></label></p>
280
  <p><input id="smtp_ssl_tls" type="radio" name="smtp_ssl" value="tls" <?php checked('tls', get_option('smtp_ssl')); ?> />
281
- <label for="smtp_ssl_tls"><?php _e('Use TLS encryption. This is not the same as STARTTLS. For most servers SSL is the recommended option.'); ?></label></p>
282
  </td>
283
  </tr>
284
  <tr valign="top">
285
- <th scope="row"><?php _e('Authentication:'); ?> </th>
286
  <td>
287
  <p><input id="smtp_auth_false" type="radio" name="smtp_auth" value="false" <?php checked('false', get_option('smtp_auth')); ?> />
288
- <label for="smtp_auth_false"><?php _e('No: Do not use SMTP authentication.'); ?></label></p>
289
  <p><input id="smtp_auth_true" type="radio" name="smtp_auth" value="true" <?php checked('true', get_option('smtp_auth')); ?> />
290
- <label for="smtp_auth_true"><?php _e('Yes: Use SMTP authentication.'); ?></label></p>
291
- <p><?php _e('If this is set to no, the values below are ignored.'); ?></p>
292
  </td>
293
  </tr>
294
  <tr valign="top">
295
- <th scope="row"><?php _e('Username:'); ?> </th>
296
  <td><input name="smtp_user" type="text" id="smtp_user" value="<?php print(get_option('smtp_user')); ?>" size="40" class="code" /></td>
297
  </tr>
298
  <tr valign="top">
299
- <th scope="row"><?php _e('Password:'); ?> </th>
300
  <td><input name="smtp_pass" type="text" id="smtp_pass" value="<?php print(get_option('smtp_pass')); ?>" size="40" class="code" /></td>
301
  </tr>
302
  </table>
303
 
304
- <p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;'); ?>" />
305
  <input type="hidden" name="action" value="update" />
306
  </p>
307
  <input type="hidden" name="option_page" value="email">
@@ -310,15 +309,15 @@ function wp_mail_smtp_options_page() {
310
 
311
  <form method="POST">
312
  <fieldset class="options">
313
- <legend><?php _e('Send a Test Email'); ?></legend>
314
  <table class="optiontable">
315
  <tr valign="top">
316
- <th scope="row"><?php _e('To:'); ?> </th>
317
  <td><p><input name="to" type="text" id="to" value="" size="40" class="code" /><br />
318
- <?php _e('Type an email address here and then click Send Test to generate a test email.'); ?></p></td>
319
  </tr>
320
  </table>
321
- <p class="submit"><input type="submit" name="wpms_action" value="<?php _e('Send Test'); ?>" /></p>
322
  </fieldset>
323
  </form>
324
 
@@ -336,7 +335,7 @@ if (!function_exists('wp_mail_smtp_menus')) :
336
  function wp_mail_smtp_menus() {
337
 
338
  if (function_exists('add_submenu_page')) {
339
- add_options_page(__('Advanced Email Options'),__('Email'),'manage_options',__FILE__,'wp_mail_smtp_options_page');
340
  }
341
 
342
  } // End of wp_mail_smtp_menus() function definition
@@ -411,7 +410,7 @@ function wp_mail_smtp_mail_from_name ($orig) {
411
  // Only filter if the from name is the default
412
  if ($orig == 'WordPress') {
413
  if (defined('WPMS_ON') && WPMS_ON)
414
- return WPMS_MAIL_FROM;
415
  elseif ( get_option('mail_from_name') != "" && is_string(get_option('mail_from_name')) )
416
  return get_option('mail_from_name');
417
  }
@@ -422,13 +421,26 @@ function wp_mail_smtp_mail_from_name ($orig) {
422
  } // End of wp_mail_smtp_mail_from_name() function definition
423
  endif;
424
 
 
 
 
 
 
425
 
426
- add_action('phpmailer_init','phpmailer_init_smtp_constants');
 
 
 
 
 
 
 
 
 
 
427
  if (!defined('WPMS_ON') || !WPMS_ON) {
428
  // Whitelist our options
429
  add_filter('whitelist_options', 'wp_mail_smtp_whitelist_options');
430
- // Add an action on phpmailer_init
431
- add_action('phpmailer_init','phpmailer_init_smtp');
432
  // Add the create pages options
433
  add_action('admin_menu','wp_mail_smtp_menus');
434
  // Add an activation hook for this plugin
@@ -438,6 +450,12 @@ if (!defined('WPMS_ON') || !WPMS_ON) {
438
  add_filter('wp_mail_from','wp_mail_smtp_mail_from');
439
  add_filter('wp_mail_from_name','wp_mail_smtp_mail_from_name');
440
 
441
- load_plugin_textdomain('wp_mail_smtp', dirname(plugin_basename(__FILE__)) . '/langs');
 
 
 
 
 
 
442
 
443
- ?>
1
  <?php
2
  /*
3
  Plugin Name: WP-Mail-SMTP
4
+ Version: 0.8.3
5
  Plugin URI: http://www.callum-macdonald.com/code/wp-mail-smtp/
6
  Description: Reconfigures the wp_mail() function to use SMTP instead of mail() and creates an options page to manage the settings.
7
  Author: Callum Macdonald
36
  */
37
 
38
  /**
 
 
 
 
39
  * CHANGELOG
40
  *
41
+ * 0.8.3 - Bugfix, return WPMS_MAIL_FROM_NAME, props nacin.
42
+ * 0.8.2 - Bugfix, call phpmailer_init_smtp() correctly, props Sinklar.
43
+ * 0.8.1 - Internationalisation improvements.
44
  * 0.8 - Added port, SSL/TLS, option whitelisting, validate_email(), and constant options.
45
  * 0.7 - Added checks to only override the default from name / email
46
  * 0.6 - Added additional SMTP debugging output
189
  }
190
 
191
  // Send a test mail if necessary
192
+ if (isset($_POST['wpms_action']) && $_POST['wpms_action'] == __('Send Test', 'wp_mail_smtp') && isset($_POST['to'])) {
193
 
194
  // Set up the mail variables
195
  $to = $_POST['to'];
196
+ $subject = 'WP Mail SMTP: ' . __('Test mail to ', 'wp_mail_smtp') . $to;
197
+ $message = __('This is a test email generated by the WP Mail SMTP WordPress plugin.', 'wp_mail_smtp');
198
 
199
  // Set SMTPDebug to level 2
200
  $phpmailer->SMTPDebug = 2;
201
 
202
  // Start output buffering to grab smtp debugging output
203
  ob_start();
204
+
205
  // Send the test mail
206
  $result = wp_mail($to,$subject,$message);
207
 
210
 
211
  // Output the response
212
  ?>
213
+ <div id="message" class="updated fade"><p><strong><?php _e('Test Message Sent', 'wp_mail_smtp'); ?></strong></p>
214
+ <p><?php _e('The result was:', 'wp_mail_smtp'); ?></p>
215
  <pre><?php var_dump($result); ?></pre>
216
  <?php if ($result != true) { ?>
217
+ <p><?php _e('The full debugging output is shown below:', 'wp_mail_smtp'); ?></p>
218
  <pre><?php var_dump($phpmailer); ?></pre>
219
  <?php } ?>
220
+ <p><?php _e('The SMTP debugging output is shown below:', 'wp_mail_smtp'); ?></p>
221
  <pre><?php echo $smtp_debug ?></pre>
222
  </div>
223
  <?php
224
+
225
  }
226
 
227
  ?>
228
  <div class="wrap">
229
+ <h2><?php _e('Advanced Email Options', 'wp_mail_smtp'); ?></h2>
230
  <form method="post" action="options.php">
231
  <?php wp_nonce_field('email-options'); ?>
232
+ <p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;', 'wp_mail_smtp'); ?>" />
233
  <fieldset class="options">
234
+ <legend><?php _e('From', 'wp_mail_smtp'); ?></legend>
235
  <table class="optiontable">
236
  <tr valign="top">
237
+ <th scope="row"><?php _e('From Email:', 'wp_mail_smtp'); ?> </th>
238
  <td><p><input name="mail_from" type="text" id="mail_from" value="<?php print(get_option('mail_from')); ?>" size="40" class="code" /><br />
239
+ <?php _e('You can specify the email address that emails should be sent from. If you leave this blank, the admin 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&lt;email@domain.com&gt; in this field.', 'wp_mail_smtp'); print('</span>'); } ?></p></td>
240
  </tr>
241
  <tr valign="top">
242
+ <th scope="row"><?php _e('From Name:', 'wp_mail_smtp'); ?> </th>
243
  <td><p><input name="mail_from_name" type="text" id="mail_from_name" value="<?php print(get_option('mail_from_name')); ?>" size="40" class="code" /><br />
244
+ <?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></td>
245
  </tr>
246
  </table>
247
 
248
+ <legend><?php _e('Mailer', 'wp_mail_smtp'); ?></legend>
249
  <table class="optiontable">
250
  <tr valign="top">
251
+ <th scope="row"><?php _e('Mailer:', 'wp_mail_smtp'); ?> </th>
252
  <td>
253
  <p><input id="mailer_smtp" type="radio" name="mailer" value="smtp" <?php checked('smtp', get_option('mailer')); ?> />
254
+ <label for="mailer_smtp"><?php _e('Send all WordPress emails via SMTP.', 'wp_mail_smtp'); ?></label></p>
255
  <p><input id="mailer_mail" type="radio" name="mailer" value="mail" <?php checked('mail', get_option('mailer')); ?> />
256
+ <label for="mailer_mail"><?php _e('Use the PHP mail() function to send emails.', 'wp_mail_smtp'); ?></label></p>
257
  </td>
258
  </tr>
259
  </table>
260
 
261
+ <legend><?php _e('SMTP Options', 'wp_mail_smtp'); ?></legend>
262
+ <p><?php _e('These options only apply if you have chosen to send mail by SMTP above.', 'wp_mail_smtp'); ?></p>
263
  <table class="optiontable">
264
  <tr valign="top">
265
+ <th scope="row"><?php _e('SMTP Host:', 'wp_mail_smtp'); ?> </th>
266
  <td><input name="smtp_host" type="text" id="smtp_host" value="<?php print(get_option('smtp_host')); ?>" size="40" class="code" /></td>
267
  </tr>
268
  <tr valign="top">
269
+ <th scope="row"><?php _e('SMTP Port:', 'wp_mail_smtp'); ?> </th>
270
  <td><input name="smtp_port" type="text" id="smtp_port" value="<?php print(get_option('smtp_port')); ?>" size="6" class="code" /></td>
271
  </tr>
272
  <tr valign="top">
273
+ <th scope="row"><?php _e('Encryption:', 'wp_mail_smtp'); ?> </th>
274
  <td>
275
  <p><input id="smtp_ssl_none" type="radio" name="smtp_ssl" value="none" <?php checked('none', get_option('smtp_ssl')); ?> />
276
+ <label for="smtp_ssl_none"><?php _e('No encryption.', 'wp_mail_smtp'); ?></label></p>
277
  <p><input id="smtp_ssl_ssl" type="radio" name="smtp_ssl" value="ssl" <?php checked('ssl', get_option('smtp_ssl')); ?> />
278
+ <label for="smtp_ssl_ssl"><?php _e('Use SSL encryption.', 'wp_mail_smtp'); ?></label></p>
279
  <p><input id="smtp_ssl_tls" type="radio" name="smtp_ssl" value="tls" <?php checked('tls', get_option('smtp_ssl')); ?> />
280
+ <label for="smtp_ssl_tls"><?php _e('Use TLS encryption. This is not the same as STARTTLS. For most servers SSL is the recommended option.', 'wp_mail_smtp'); ?></label></p>
281
  </td>
282
  </tr>
283
  <tr valign="top">
284
+ <th scope="row"><?php _e('Authentication:', 'wp_mail_smtp'); ?> </th>
285
  <td>
286
  <p><input id="smtp_auth_false" type="radio" name="smtp_auth" value="false" <?php checked('false', get_option('smtp_auth')); ?> />
287
+ <label for="smtp_auth_false"><?php _e('No: Do not use SMTP authentication.', 'wp_mail_smtp'); ?></label></p>
288
  <p><input id="smtp_auth_true" type="radio" name="smtp_auth" value="true" <?php checked('true', get_option('smtp_auth')); ?> />
289
+ <label for="smtp_auth_true"><?php _e('Yes: Use SMTP authentication.', 'wp_mail_smtp'); ?></label></p>
290
+ <p><?php _e('If this is set to no, the values below are ignored.', 'wp_mail_smtp'); ?></p>
291
  </td>
292
  </tr>
293
  <tr valign="top">
294
+ <th scope="row"><?php _e('Username:', 'wp_mail_smtp'); ?> </th>
295
  <td><input name="smtp_user" type="text" id="smtp_user" value="<?php print(get_option('smtp_user')); ?>" size="40" class="code" /></td>
296
  </tr>
297
  <tr valign="top">
298
+ <th scope="row"><?php _e('Password:', 'wp_mail_smtp'); ?> </th>
299
  <td><input name="smtp_pass" type="text" id="smtp_pass" value="<?php print(get_option('smtp_pass')); ?>" size="40" class="code" /></td>
300
  </tr>
301
  </table>
302
 
303
+ <p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options &raquo;', 'wp_mail_smtp'); ?>" />
304
  <input type="hidden" name="action" value="update" />
305
  </p>
306
  <input type="hidden" name="option_page" value="email">
309
 
310
  <form method="POST">
311
  <fieldset class="options">
312
+ <legend><?php _e('Send a Test Email', 'wp_mail_smtp'); ?></legend>
313
  <table class="optiontable">
314
  <tr valign="top">
315
+ <th scope="row"><?php _e('To:', 'wp_mail_smtp'); ?> </th>
316
  <td><p><input name="to" type="text" id="to" value="" size="40" class="code" /><br />
317
+ <?php _e('Type an email address here and then click Send Test to generate a test email.', 'wp_mail_smtp'); ?></p></td>
318
  </tr>
319
  </table>
320
+ <p class="submit"><input type="submit" name="wpms_action" value="<?php _e('Send Test', 'wp_mail_smtp'); ?>" /></p>
321
  </fieldset>
322
  </form>
323
 
335
  function wp_mail_smtp_menus() {
336
 
337
  if (function_exists('add_submenu_page')) {
338
+ add_options_page(__('Advanced Email Options', 'wp_mail_smtp'),__('Email', 'wp_mail_smtp'),'manage_options',__FILE__,'wp_mail_smtp_options_page');
339
  }
340
 
341
  } // End of wp_mail_smtp_menus() function definition
410
  // Only filter if the from name is the default
411
  if ($orig == 'WordPress') {
412
  if (defined('WPMS_ON') && WPMS_ON)
413
+ return WPMS_MAIL_FROM_NAME;
414
  elseif ( get_option('mail_from_name') != "" && is_string(get_option('mail_from_name')) )
415
  return get_option('mail_from_name');
416
  }
421
  } // End of wp_mail_smtp_mail_from_name() function definition
422
  endif;
423
 
424
+ function wp_mail_plugin_action_links( $links, $file ) {
425
+ if ( $file != plugin_basename( __FILE__ ))
426
+ return $links;
427
+
428
+ $settings_link = '<a href="plugins.php?page=wp-mail-smtp/wp_mail_smtp.php">' . esc_html( __( 'Settings', 'wp_mail_smtp' ) ) . '</a>';
429
 
430
+ array_unshift( $links, $settings_link );
431
+
432
+ return $links;
433
+ }
434
+
435
+ function add_tabs() {
436
+ add_submenu_page('plugins.php', __('WP Mail Options', 'wp_mail_smtp'), __('WP Mail Options', 'wp_mail_smtp'), 'manage_options', __FILE__,'wp_mail_smtp_options_page');
437
+ }
438
+
439
+ // Add an action on phpmailer_init
440
+ add_action('phpmailer_init','phpmailer_init_smtp');
441
  if (!defined('WPMS_ON') || !WPMS_ON) {
442
  // Whitelist our options
443
  add_filter('whitelist_options', 'wp_mail_smtp_whitelist_options');
 
 
444
  // Add the create pages options
445
  add_action('admin_menu','wp_mail_smtp_menus');
446
  // Add an activation hook for this plugin
450
  add_filter('wp_mail_from','wp_mail_smtp_mail_from');
451
  add_filter('wp_mail_from_name','wp_mail_smtp_mail_from_name');
452
 
453
+ // admin options
454
+ add_action('admin_menu', 'add_tabs',1);
455
+
456
+ // adds "Settings" link to the plugin action page
457
+ add_filter( 'plugin_action_links', 'wp_mail_plugin_action_links',10,2);
458
+
459
+ load_plugin_textdomain('wp_mail_smtp', false, dirname(plugin_basename(__FILE__)) . '/langs');
460
 
461
+ ?>