WP Mail SMTP by WPForms - Version 0.5.0

Version Description

Download this release

Release Info

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

Code changes from version 0.4.2 to 0.5.0

Files changed (2) hide show
  1. readme.txt +10 -4
  2. wp_mail_smtp.php +31 -10
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  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.0
6
  Tested up to: 2.3
7
- Stable tag: 0.4.2
8
 
9
  Reconfigures the wp_mail() function to use SMTP instead of mail() and creates an options page to manage host, username, password, etc.
10
 
@@ -21,8 +21,8 @@ You can set the following options:
21
 
22
  == Installation ==
23
 
24
- 1. Download the wp_mail_smtp.php file.
25
- 2. Upload the file to your `/wp-contents/plugins/` directory.
26
  3. Activate the plugin through the 'Plugins' menu in WordPress.
27
 
28
  == Frequently Asked Questions ==
@@ -45,6 +45,12 @@ Short answer: maybe.
45
  By all means please contact me to discuss features or options you'd like to see added to the plugin. I can't guarantee to add all of them, but I will consider all sensible requests. I can be contacted here:
46
  <http://www.callum-macdonald.com/contact/>
47
 
 
 
 
 
 
 
48
  == Screenshots ==
49
 
50
  1. Screenshot of the Options > Email panel.
2
  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.3
6
  Tested up to: 2.3
7
+ Stable tag: 0.5
8
 
9
  Reconfigures the wp_mail() function to use SMTP instead of mail() and creates an options page to manage host, username, password, etc.
10
 
21
 
22
  == Installation ==
23
 
24
+ 1. Download
25
+ 2. Upload to your `/wp-contents/plugins/` directory.
26
  3. Activate the plugin through the 'Plugins' menu in WordPress.
27
 
28
  == Frequently Asked Questions ==
45
  By all means please contact me to discuss features or options you'd like to see added to the plugin. I can't guarantee to add all of them, but I will consider all sensible requests. I can be contacted here:
46
  <http://www.callum-macdonald.com/contact/>
47
 
48
+ = Will this plugin work with WordPress version < 2.3? =
49
+
50
+ Short answer: no.
51
+
52
+ WordPress version 2.3 introduced two new filters for mail_from and mail_from_name, which allow you to set the two variables separately. Previously, both were set in one filter. From version 0.5 this change was introduced, so the plugin will not work with versions prevoius to 2.3. However, you could use version 4.2 of this plugin instead, that should work with earlier versions of WordPress.
53
+
54
  == Screenshots ==
55
 
56
  1. Screenshot of the Options > Email panel.
wp_mail_smtp.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: WP-Mail-SMTP
4
- Version: 0.4.2
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 host, username, password, etc.
7
  Author: Callum Macdonald
@@ -22,6 +22,7 @@ Author URI: http://www.callum-macdonald.com/
22
  *
23
  * CHANGELOG
24
  *
 
25
  * 0.4.2 - Fixed a bug in 0.4.1 and added more debugging output
26
  * 0.4.1 - Added $phpmailer->ErroInfo to the test mail output
27
  * 0.4 - Added the test email feature and cleaned up some other bits and pieces
@@ -35,6 +36,7 @@ Author URI: http://www.callum-macdonald.com/
35
  // Array of options and their default values
36
  $wpms_options = array (
37
  'mail_from' => '',
 
38
  'mailer' => 'smtp',
39
  'smtp_host' => 'localhost',
40
  'smtp_auth' => false,
@@ -141,9 +143,14 @@ if (!function_exists('wp_mail_smtp_options_page')) {
141
  <legend><?php _e('From'); ?></legend>
142
  <table class="optiontable">
143
  <tr valign="top">
144
- <th scope="row"><?php _e('From:'); ?> </th>
145
  <td><p><input name="mail_from" type="text" id="mail_from" value="<?php print(get_option('mail_from')); ?>" size="40" class="code" /><br />
146
- <?php _e('You can specify just an email address or a name and email address in the form &quot;Name&lt;email@example.com&gt;&quot;. If this is left blank or does not contain an @ symbol, the admin email will be used.'); ?></p></td>
 
 
 
 
 
147
  </tr>
148
  </table>
149
 
@@ -231,17 +238,12 @@ if (!function_exists('wp_mail_smtp_menus')) {
231
  }
232
 
233
  /**
234
- * This function sets who the mail is from
235
  */
236
  if (!function_exists('wp_mail_smtp_mail_from')) {
237
 
238
  function wp_mail_smtp_mail_from ($orig) {
239
 
240
- /**
241
- * //// CHMAC TODO
242
- * Does this work or does it fail if a name is supplied? Testing required.
243
- */
244
-
245
  // If we can, use the is_email function to verify the email
246
  if ( function_exists('is_email') ) {
247
  if ( is_email( get_option('mail_from') ) ) {
@@ -264,13 +266,32 @@ if (!function_exists('wp_mail_smtp_mail_from')) {
264
 
265
  }
266
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  // Add an action on phpmailer_init
268
  add_action('phpmailer_init','phpmailer_init_smtp');
269
  // Add the create pages options
270
  add_action('admin_menu','wp_mail_smtp_menus');
271
  // Add an activation hook for this plugin
272
  register_activation_hook(__FILE__,'wp_mail_smtp_activate');
273
- // Add a filter to replace the mail from address
274
  add_filter('wp_mail_from','wp_mail_smtp_mail_from');
 
275
 
276
  ?>
1
  <?php
2
  /*
3
  Plugin Name: WP-Mail-SMTP
4
+ Version: 0.5.0
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 host, username, password, etc.
7
  Author: Callum Macdonald
22
  *
23
  * CHANGELOG
24
  *
25
+ * 0.5.0 - Upgraded to match 2.3 filters which add a second filter for from name
26
  * 0.4.2 - Fixed a bug in 0.4.1 and added more debugging output
27
  * 0.4.1 - Added $phpmailer->ErroInfo to the test mail output
28
  * 0.4 - Added the test email feature and cleaned up some other bits and pieces
36
  // Array of options and their default values
37
  $wpms_options = array (
38
  'mail_from' => '',
39
+ 'mail_from_name' => '',
40
  'mailer' => 'smtp',
41
  'smtp_host' => 'localhost',
42
  'smtp_auth' => false,
143
  <legend><?php _e('From'); ?></legend>
144
  <table class="optiontable">
145
  <tr valign="top">
146
+ <th scope="row"><?php _e('From Email:'); ?> </th>
147
  <td><p><input name="mail_from" type="text" id="mail_from" value="<?php print(get_option('mail_from')); ?>" size="40" class="code" /><br />
148
+ <?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.'); ?></p></td>
149
+ </tr>
150
+ <tr valign="top">
151
+ <th scope="row"><?php _e('From Name:'); ?> </th>
152
+ <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 />
153
+ <?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>
154
  </tr>
155
  </table>
156
 
238
  }
239
 
240
  /**
241
+ * This function sets the from email value
242
  */
243
  if (!function_exists('wp_mail_smtp_mail_from')) {
244
 
245
  function wp_mail_smtp_mail_from ($orig) {
246
 
 
 
 
 
 
247
  // If we can, use the is_email function to verify the email
248
  if ( function_exists('is_email') ) {
249
  if ( is_email( get_option('mail_from') ) ) {
266
 
267
  }
268
 
269
+ /**
270
+ * This function sets the from name value
271
+ */
272
+ if (!function_exists('wp_mail_smtp_mail_from_name')) {
273
+
274
+ function wp_mail_smtp_mail_from_name ($orig) {
275
+
276
+ if (get_option('mail_from_name') != "" && is_string(get_option('mail_from_name'))) {
277
+ return get_option('mail_from_name');
278
+ }
279
+ else {
280
+ return $orig;
281
+ }
282
+
283
+ } // End of wp_mail_smtp_mail_from_name() function definition
284
+
285
+ }
286
+
287
  // Add an action on phpmailer_init
288
  add_action('phpmailer_init','phpmailer_init_smtp');
289
  // Add the create pages options
290
  add_action('admin_menu','wp_mail_smtp_menus');
291
  // Add an activation hook for this plugin
292
  register_activation_hook(__FILE__,'wp_mail_smtp_activate');
293
+ // Add filters to replace the mail from name and emailaddress
294
  add_filter('wp_mail_from','wp_mail_smtp_mail_from');
295
+ add_filter('wp_mail_from_name','wp_mail_smtp_mail_from_name');
296
 
297
  ?>