WP Mail SMTP by WPForms - Version 0.6

Version Description

Download this release

Release Info

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

Code changes from version 0.5.2 to 0.6

Files changed (2) hide show
  1. readme.txt +2 -2
  2. wp_mail_smtp.php +23 -2
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.0
6
- Tested up to: 2.3
7
- Stable tag: 0.5.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
 
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.5.1
7
+ Stable tag: 0.6
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
 
wp_mail_smtp.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: WP-Mail-SMTP
4
- Version: 0.5.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
@@ -10,7 +10,7 @@ Author URI: http://www.callum-macdonald.com/
10
 
11
  /**
12
  * @author Callum Macdonald
13
- * @copyright Callum Macdonald, 2007, All Rights Reserved
14
  * This code is released under the GPL licence version 3 or later, available here
15
  * http://www.gnu.org/licenses/gpl.txt
16
  */
@@ -22,6 +22,7 @@ Author URI: http://www.callum-macdonald.com/
22
  *
23
  * CHANGELOG
24
  *
 
25
  * 0.5.2 - Fixed a pre 2.3 bug to do with mail from
26
  * 0.5.1 - Added a check to display a warning on versions prior to 2.3
27
  * 0.5.0 - Upgraded to match 2.3 filters which add a second filter for from name
@@ -110,6 +111,15 @@ if (!function_exists('wp_mail_smtp_options_page')) {
110
  // Load the options
111
  global $wpms_options, $phpmailer;
112
 
 
 
 
 
 
 
 
 
 
113
  // Send a test mail if necessary
114
  if (isset($_POST['wpms_action']) && $_POST['wpms_action'] == __('Send Test') && isset($_POST['to'])) {
115
 
@@ -118,9 +128,18 @@ if (!function_exists('wp_mail_smtp_options_page')) {
118
  $subject = "WP Mail SMTP: Test mail to " . $to;
119
  $message = "This is a test email generated by the WP Mail SMTP WordPress plugin.";
120
 
 
 
 
 
 
 
121
  // Send the test mail
122
  $result = wp_mail($to,$subject,$message);
123
 
 
 
 
124
  // Output the response
125
  ?>
126
  <div id="message" class="updated fade"><p><strong><?php _e('Test Message Sent'); ?></strong></p>
@@ -130,6 +149,8 @@ if (!function_exists('wp_mail_smtp_options_page')) {
130
  <p><?php _e('The full debugging output is shown below:'); ?></p>
131
  <pre><?php var_dump($phpmailer); ?></pre>
132
  <?php } ?>
 
 
133
  </div>
134
  <?php
135
 
1
  <?php
2
  /*
3
  Plugin Name: WP-Mail-SMTP
4
+ Version: 0.6
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
10
 
11
  /**
12
  * @author Callum Macdonald
13
+ * @copyright Callum Macdonald, 2007-8, All Rights Reserved
14
  * This code is released under the GPL licence version 3 or later, available here
15
  * http://www.gnu.org/licenses/gpl.txt
16
  */
22
  *
23
  * CHANGELOG
24
  *
25
+ * 0.6 - Added additional SMTP debugging output
26
  * 0.5.2 - Fixed a pre 2.3 bug to do with mail from
27
  * 0.5.1 - Added a check to display a warning on versions prior to 2.3
28
  * 0.5.0 - Upgraded to match 2.3 filters which add a second filter for from name
111
  // Load the options
112
  global $wpms_options, $phpmailer;
113
 
114
+ // Make sure the PHPMailer class has been instantiated
115
+ // (copied verbatim from wp-includes/pluggable.php)
116
+ // (Re)create it, if it's gone missing
117
+ if ( !is_object( $phpmailer ) || !is_a( $phpmailer, 'PHPMailer' ) ) {
118
+ require_once ABSPATH . WPINC . '/class-phpmailer.php';
119
+ require_once ABSPATH . WPINC . '/class-smtp.php';
120
+ $phpmailer = new PHPMailer();
121
+ }
122
+
123
  // Send a test mail if necessary
124
  if (isset($_POST['wpms_action']) && $_POST['wpms_action'] == __('Send Test') && isset($_POST['to'])) {
125
 
128
  $subject = "WP Mail SMTP: Test mail to " . $to;
129
  $message = "This is a test email generated by the WP Mail SMTP WordPress plugin.";
130
 
131
+ // Set SMTPDebug to level 2
132
+ $phpmailer->SMTPDebug = 2;
133
+
134
+ // Start output buffering to grab smtp debugging output
135
+ ob_start();
136
+
137
  // Send the test mail
138
  $result = wp_mail($to,$subject,$message);
139
 
140
+ // Grab the smtp debugging output
141
+ $smtp_debug = ob_get_clean();
142
+
143
  // Output the response
144
  ?>
145
  <div id="message" class="updated fade"><p><strong><?php _e('Test Message Sent'); ?></strong></p>
149
  <p><?php _e('The full debugging output is shown below:'); ?></p>
150
  <pre><?php var_dump($phpmailer); ?></pre>
151
  <?php } ?>
152
+ <p><?php _e('The SMTP debugging output is shown below:'); ?></p>
153
+ <pre><?php echo $smtp_debug ?></pre>
154
  </div>
155
  <?php
156