<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[19849] trunk/wp-includes: Upgrade PHPMailer to 5.2.1.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/19849">19849</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2012-02-07 16:13:51 +0000 (Tue, 07 Feb 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Upgrade PHPMailer to 5.2.1. Props MattyRob. fixes <a href="http://core.trac.wordpress.org/ticket/19887">#19887</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesclassphpmailerphp">trunk/wp-includes/class-phpmailer.php</a></li>
<li><a href="#trunkwpincludesclasssmtpphp">trunk/wp-includes/class-smtp.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesclassphpmailerphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-phpmailer.php (19848 => 19849)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-phpmailer.php        2012-02-07 11:33:39 UTC (rev 19848)
+++ trunk/wp-includes/class-phpmailer.php        2012-02-07 16:13:51 UTC (rev 19849)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> /*~ class.phpmailer.php
</span><span class="cx"> .---------------------------------------------------------------------------.
</span><span class="cx"> |  Software: PHPMailer - PHP email class                                    |
</span><del>-|   Version: 5.2                                                            |
</del><ins>+|   Version: 5.2.1                                                          |
</ins><span class="cx"> |      Site: https://code.google.com/a/apache-extras.org/p/phpmailer/       |
</span><span class="cx"> | ------------------------------------------------------------------------- |
</span><span class="cx"> |     Admin: Jim Jagielski (project admininistrator)                        |
</span><span class="lines">@@ -10,7 +10,7 @@
</span><span class="cx"> |          : Marcus Bointon (coolbru) coolbru@users.sourceforge.net         |
</span><span class="cx"> |          : Jim Jagielski (jimjag) jimjag@gmail.com                        |
</span><span class="cx"> |   Founder: Brent R. Matzelle (original founder)                           |
</span><del>-| Copyright (c) 2010-2011, Jim Jagielski. All Rights Reserved.               |
</del><ins>+| Copyright (c) 2010-2012, Jim Jagielski. All Rights Reserved.              |
</ins><span class="cx"> | Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved.               |
</span><span class="cx"> | Copyright (c) 2001-2003, Brent R. Matzelle                                |
</span><span class="cx"> | ------------------------------------------------------------------------- |
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx">  * @author Andy Prevost
</span><span class="cx">  * @author Marcus Bointon
</span><span class="cx">  * @author Jim Jagielski
</span><del>- * @copyright 2010 - 2011 Jim Jagielski
</del><ins>+ * @copyright 2010 - 2012 Jim Jagielski
</ins><span class="cx">  * @copyright 2004 - 2009 Andy Prevost
</span><span class="cx">  * @version $Id: class.phpmailer.php 450 2010-06-23 16:46:33Z coolbru $
</span><span class="cx">  * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
</span><span class="lines">@@ -130,6 +130,13 @@
</span><span class="cx">   protected $MIMEHeader     = '';
</span><span class="cx"> 
</span><span class="cx">   /**
</span><ins>+   * Stores the complete sent MIME message (Body and Headers)
+   * @var string
+   * @access protected
+  */
+  protected $SentMIMEMessage     = '';
+
+  /**
</ins><span class="cx">    * Sets word wrapping on the body of the message to a given number of
</span><span class="cx">    * characters.
</span><span class="cx">    * @var int
</span><span class="lines">@@ -317,7 +324,7 @@
</span><span class="cx">    * Sets the PHPMailer Version number
</span><span class="cx">    * @var string
</span><span class="cx">    */
</span><del>-  public $Version         = '5.2';
</del><ins>+  public $Version         = '5.2.1';
</ins><span class="cx"> 
</span><span class="cx">   /**
</span><span class="cx">    * What to use in the X-Mailer header
</span><span class="lines">@@ -460,7 +467,7 @@
</span><span class="cx">    * @return boolean
</span><span class="cx">    */
</span><span class="cx">   public function AddReplyTo($address, $name = '') {
</span><del>-    return $this-&gt;AddAnAddress('ReplyTo', $address, $name);
</del><ins>+    return $this-&gt;AddAnAddress('Reply-To', $address, $name);
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">   /**
</span><span class="lines">@@ -473,12 +480,14 @@
</span><span class="cx">    * @access protected
</span><span class="cx">    */
</span><span class="cx">   protected function AddAnAddress($kind, $address, $name = '') {
</span><del>-    if (!preg_match('/^(to|cc|bcc|ReplyTo)$/', $kind)) {
</del><ins>+    if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) {
</ins><span class="cx">       $this-&gt;SetError($this-&gt;Lang('Invalid recipient array').': '.$kind);
</span><span class="cx">       if ($this-&gt;exceptions) {
</span><span class="cx">         throw new phpmailerException('Invalid recipient array: ' . $kind);
</span><span class="cx">       }
</span><del>-      echo $this-&gt;Lang('Invalid recipient array').': '.$kind;
</del><ins>+          if ($this-&gt;SMTPDebug) {
+        echo $this-&gt;Lang('Invalid recipient array').': '.$kind;
+      }
</ins><span class="cx">       return false;
</span><span class="cx">     }
</span><span class="cx">     $address = trim($address);
</span><span class="lines">@@ -488,10 +497,12 @@
</span><span class="cx">       if ($this-&gt;exceptions) {
</span><span class="cx">         throw new phpmailerException($this-&gt;Lang('invalid_address').': '.$address);
</span><span class="cx">       }
</span><del>-      echo $this-&gt;Lang('invalid_address').': '.$address;
</del><ins>+          if ($this-&gt;SMTPDebug) {
+        echo $this-&gt;Lang('invalid_address').': '.$address;
+      }
</ins><span class="cx">       return false;
</span><span class="cx">     }
</span><del>-    if ($kind != 'ReplyTo') {
</del><ins>+    if ($kind != 'Reply-To') {
</ins><span class="cx">       if (!isset($this-&gt;all_recipients[strtolower($address)])) {
</span><span class="cx">         array_push($this-&gt;$kind, array($address, $name));
</span><span class="cx">         $this-&gt;all_recipients[strtolower($address)] = true;
</span><span class="lines">@@ -520,14 +531,16 @@
</span><span class="cx">       if ($this-&gt;exceptions) {
</span><span class="cx">         throw new phpmailerException($this-&gt;Lang('invalid_address').': '.$address);
</span><span class="cx">       }
</span><del>-      echo $this-&gt;Lang('invalid_address').': '.$address;
</del><ins>+          if ($this-&gt;SMTPDebug) {
+        echo $this-&gt;Lang('invalid_address').': '.$address;
+      }
</ins><span class="cx">       return false;
</span><span class="cx">     }
</span><span class="cx">     $this-&gt;From = $address;
</span><span class="cx">     $this-&gt;FromName = $name;
</span><span class="cx">     if ($auto) {
</span><span class="cx">       if (empty($this-&gt;ReplyTo)) {
</span><del>-        $this-&gt;AddAnAddress('ReplyTo', $address, $name);
</del><ins>+        $this-&gt;AddAnAddress('Reply-To', $address, $name);
</ins><span class="cx">       }
</span><span class="cx">       if (empty($this-&gt;Sender)) {
</span><span class="cx">         $this-&gt;Sender = $address;
</span><span class="lines">@@ -574,6 +587,7 @@
</span><span class="cx">       if(!$this-&gt;PreSend()) return false;
</span><span class="cx">       return $this-&gt;PostSend();
</span><span class="cx">     } catch (phpmailerException $e) {
</span><ins>+          $this-&gt;SentMIMEMessage = '';
</ins><span class="cx">       $this-&gt;SetError($e-&gt;getMessage());
</span><span class="cx">       if ($this-&gt;exceptions) {
</span><span class="cx">         throw $e;
</span><span class="lines">@@ -584,6 +598,7 @@
</span><span class="cx"> 
</span><span class="cx">   protected function PreSend() {
</span><span class="cx">     try {
</span><ins>+          $mailHeader = &quot;&quot;;
</ins><span class="cx">       if ((count($this-&gt;to) + count($this-&gt;cc) + count($this-&gt;bcc)) &lt; 1) {
</span><span class="cx">         throw new phpmailerException($this-&gt;Lang('provide_address'), self::STOP_CRITICAL);
</span><span class="cx">       }
</span><span class="lines">@@ -603,6 +618,19 @@
</span><span class="cx">       $this-&gt;MIMEHeader = $this-&gt;CreateHeader();
</span><span class="cx">       $this-&gt;MIMEBody = $this-&gt;CreateBody();
</span><span class="cx"> 
</span><ins>+      // To capture the complete message when using mail(), create
+          // an extra header list which CreateHeader() doesn't fold in
+      if ($this-&gt;Mailer == 'mail') {
+        if (count($this-&gt;to) &gt; 0) {
+          $mailHeader .= $this-&gt;AddrAppend(&quot;To&quot;, $this-&gt;to);
+        } else {
+          $mailHeader .= $this-&gt;HeaderLine(&quot;To&quot;, &quot;undisclosed-recipients:;&quot;);
+        }
+        $mailHeader .= $this-&gt;HeaderLine('Subject', $this-&gt;EncodeHeader($this-&gt;SecureHeader(trim($this-&gt;Subject))));
+        // if(count($this-&gt;cc) &gt; 0) {
+            // $mailHeader .= $this-&gt;AddrAppend(&quot;Cc&quot;, $this-&gt;cc);
+        // }
+      }
</ins><span class="cx"> 
</span><span class="cx">       // digitally sign with DKIM if enabled
</span><span class="cx">       if ($this-&gt;DKIM_domain &amp;&amp; $this-&gt;DKIM_private) {
</span><span class="lines">@@ -610,7 +638,9 @@
</span><span class="cx">         $this-&gt;MIMEHeader = str_replace(&quot;\r\n&quot;, &quot;\n&quot;, $header_dkim) . $this-&gt;MIMEHeader;
</span><span class="cx">       }
</span><span class="cx"> 
</span><ins>+      $this-&gt;SentMIMEMessage = sprintf(&quot;%s%s\r\n\r\n%s&quot;,$this-&gt;MIMEHeader,$mailHeader,$this-&gt;MIMEBody);
</ins><span class="cx">       return true;
</span><ins>+
</ins><span class="cx">     } catch (phpmailerException $e) {
</span><span class="cx">       $this-&gt;SetError($e-&gt;getMessage());
</span><span class="cx">       if ($this-&gt;exceptions) {
</span><span class="lines">@@ -628,6 +658,8 @@
</span><span class="cx">           return $this-&gt;SendmailSend($this-&gt;MIMEHeader, $this-&gt;MIMEBody);
</span><span class="cx">         case 'smtp':
</span><span class="cx">           return $this-&gt;SmtpSend($this-&gt;MIMEHeader, $this-&gt;MIMEBody);
</span><ins>+        case 'mail':
+          return $this-&gt;MailSend($this-&gt;MIMEHeader, $this-&gt;MIMEBody);
</ins><span class="cx">         default:
</span><span class="cx">           return $this-&gt;MailSend($this-&gt;MIMEHeader, $this-&gt;MIMEBody);
</span><span class="cx">       }
</span><span class="lines">@@ -637,7 +669,9 @@
</span><span class="cx">       if ($this-&gt;exceptions) {
</span><span class="cx">         throw $e;
</span><span class="cx">       }
</span><del>-      echo $e-&gt;getMessage().&quot;\n&quot;;
</del><ins>+          if ($this-&gt;SMTPDebug) {
+        echo $e-&gt;getMessage().&quot;\n&quot;;
+      }
</ins><span class="cx">       return false;
</span><span class="cx">     }
</span><span class="cx">   }
</span><span class="lines">@@ -703,7 +737,7 @@
</span><span class="cx">     $to = implode(', ', $toArr);
</span><span class="cx"> 
</span><span class="cx">     if (empty($this-&gt;Sender)) {
</span><del>-      $params = &quot;-oi -f %s&quot;;
</del><ins>+      $params = &quot;-oi &quot;;
</ins><span class="cx">     } else {
</span><span class="cx">       $params = sprintf(&quot;-oi -f %s&quot;, $this-&gt;Sender);
</span><span class="cx">     }
</span><span class="lines">@@ -732,7 +766,7 @@
</span><span class="cx">           $this-&gt;doCallback($isSent, $val, $this-&gt;cc, $this-&gt;bcc, $this-&gt;Subject, $body);
</span><span class="cx">         }
</span><span class="cx">       } else {
</span><del>-        $rt = @mail($to, $this-&gt;EncodeHeader($this-&gt;SecureHeader($this-&gt;Subject)), $body, $header);
</del><ins>+        $rt = @mail($to, $this-&gt;EncodeHeader($this-&gt;SecureHeader($this-&gt;Subject)), $body, $header, $params);
</ins><span class="cx">         // implement call back function if it exists
</span><span class="cx">         $isSent = ($rt == 1) ? 1 : 0;
</span><span class="cx">         $this-&gt;doCallback($isSent, $to, $this-&gt;cc, $this-&gt;bcc, $this-&gt;Subject, $body);
</span><span class="lines">@@ -880,7 +914,9 @@
</span><span class="cx">       }
</span><span class="cx">     } catch (phpmailerException $e) {
</span><span class="cx">       $this-&gt;smtp-&gt;Reset();
</span><del>-      throw $e;
</del><ins>+          if ($this-&gt;exceptions) {
+        throw $e;
+      }
</ins><span class="cx">     }
</span><span class="cx">     return true;
</span><span class="cx">   }
</span><span class="lines">@@ -1159,7 +1195,7 @@
</span><span class="cx">           $result .= $this-&gt;HeaderLine('To', 'undisclosed-recipients:;');
</span><span class="cx">         }
</span><span class="cx">       }
</span><del>-    }
</del><ins>+        }
</ins><span class="cx"> 
</span><span class="cx">     $from = array();
</span><span class="cx">     $from[0][0] = trim($this-&gt;From);
</span><span class="lines">@@ -1177,7 +1213,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if(count($this-&gt;ReplyTo) &gt; 0) {
</span><del>-      $result .= $this-&gt;AddrAppend('Reply-to', $this-&gt;ReplyTo);
</del><ins>+      $result .= $this-&gt;AddrAppend('Reply-To', $this-&gt;ReplyTo);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // mail() sets the subject itself
</span><span class="lines">@@ -1251,6 +1287,16 @@
</span><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">   /**
</span><ins>+   * Returns the MIME message (headers and body). Only really valid post PreSend().
+   * @access public
+   * @return string
+   */
+  public function GetSentMIMEMessage() {
+    return $this-&gt;SentMIMEMessage;
+  }
+
+
+  /**
</ins><span class="cx">    * Assembles the message body.  Returns an empty string on failure.
</span><span class="cx">    * @access public
</span><span class="cx">    * @return string The assembled message body
</span><span class="lines">@@ -1363,8 +1409,8 @@
</span><span class="cx">         $signed = tempnam(&quot;&quot;, &quot;signed&quot;);
</span><span class="cx">         if (@openssl_pkcs7_sign($file, $signed, &quot;file://&quot;.$this-&gt;sign_cert_file, array(&quot;file://&quot;.$this-&gt;sign_key_file, $this-&gt;sign_key_pass), NULL)) {
</span><span class="cx">           @unlink($file);
</span><ins>+          $body = file_get_contents($signed);
</ins><span class="cx">           @unlink($signed);
</span><del>-          $body = file_get_contents($signed);
</del><span class="cx">         } else {
</span><span class="cx">           @unlink($file);
</span><span class="cx">           @unlink($signed);
</span><span class="lines">@@ -1487,7 +1533,9 @@
</span><span class="cx">       if ($this-&gt;exceptions) {
</span><span class="cx">         throw $e;
</span><span class="cx">       }
</span><del>-      echo $e-&gt;getMessage().&quot;\n&quot;;
</del><ins>+          if ($this-&gt;SMTPDebug) {
+        echo $e-&gt;getMessage().&quot;\n&quot;;
+      }
</ins><span class="cx">       if ( $e-&gt;getCode() == self::STOP_CRITICAL ) {
</span><span class="cx">         return false;
</span><span class="cx">       }
</span><span class="lines">@@ -1590,15 +1638,23 @@
</span><span class="cx">           return false;
</span><span class="cx">         }
</span><span class="cx">       }
</span><del>-      if (version_compare(PHP_VERSION, '5.3.0', '&lt;')) {
-        $magic_quotes = get_magic_quotes_runtime();
-        set_magic_quotes_runtime(0);
-      }
</del><ins>+          $magic_quotes = get_magic_quotes_runtime();
+          if ($magic_quotes) {
+        if (version_compare(PHP_VERSION, '5.3.0', '&lt;')) {
+          set_magic_quotes_runtime(0);
+        } else {
+                  ini_set('magic_quotes_runtime', 0); 
+                }
+          }
</ins><span class="cx">       $file_buffer  = file_get_contents($path);
</span><span class="cx">       $file_buffer  = $this-&gt;EncodeString($file_buffer, $encoding);
</span><del>-      if (version_compare(PHP_VERSION, '5.3.0', '&lt;')) {
-        set_magic_quotes_runtime($magic_quotes);
-      }
</del><ins>+          if ($magic_quotes) {
+        if (version_compare(PHP_VERSION, '5.3.0', '&lt;')) {
+          set_magic_quotes_runtime($magic_quotes);
+        } else {
+                  ini_set('magic_quotes_runtime', $magic_quotes); 
+            }
+          }
</ins><span class="cx">       return $file_buffer;
</span><span class="cx">     } catch (Exception $e) {
</span><span class="cx">       $this-&gt;SetError($e-&gt;getMessage());
</span><span class="lines">@@ -2154,7 +2210,7 @@
</span><span class="cx">    * @return $message
</span><span class="cx">    */
</span><span class="cx">   public function MsgHTML($message, $basedir = '') {
</span><del>-    preg_match_all(&quot;/(src|background)=\&quot;(.*)\&quot;/Ui&quot;, $message, $images);
</del><ins>+    preg_match_all(&quot;/(src|background)=[\&quot;'](.*)[\&quot;']/Ui&quot;, $message, $images);
</ins><span class="cx">     if(isset($images[2])) {
</span><span class="cx">       foreach($images[2] as $i =&gt; $url) {
</span><span class="cx">         // do not change urls for absolute images (thanks to corvuscorax)
</span><span class="lines">@@ -2168,20 +2224,23 @@
</span><span class="cx">           if ( strlen($basedir) &gt; 1 &amp;&amp; substr($basedir, -1) != '/') { $basedir .= '/'; }
</span><span class="cx">           if ( strlen($directory) &gt; 1 &amp;&amp; substr($directory, -1) != '/') { $directory .= '/'; }
</span><span class="cx">           if ( $this-&gt;AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType) ) {
</span><del>-            $message = preg_replace(&quot;/&quot;.$images[1][$i].&quot;=\&quot;&quot;.preg_quote($url, '/').&quot;\&quot;/Ui&quot;, $images[1][$i].&quot;=\&quot;&quot;.$cid.&quot;\&quot;&quot;, $message);
</del><ins>+            $message = preg_replace(&quot;/&quot;.$images[1][$i].&quot;=[\&quot;']&quot;.preg_quote($url, '/').&quot;[\&quot;']/Ui&quot;, $images[1][$i].&quot;=\&quot;&quot;.$cid.&quot;\&quot;&quot;, $message);
</ins><span class="cx">           }
</span><span class="cx">         }
</span><span class="cx">       }
</span><span class="cx">     }
</span><span class="cx">     $this-&gt;IsHTML(true);
</span><span class="cx">     $this-&gt;Body = $message;
</span><del>-    $textMsg = trim(strip_tags(preg_replace('/&lt;(head|title|style|script)[^&gt;]*&gt;.*?&lt;\/\\1&gt;/s', '', $message)));
-    if (!empty($textMsg) &amp;&amp; empty($this-&gt;AltBody)) {
-      $this-&gt;AltBody = html_entity_decode($textMsg);
-    }
</del><ins>+        if (empty($this-&gt;AltBody)) {
+                $textMsg = trim(strip_tags(preg_replace('/&lt;(head|title|style|script)[^&gt;]*&gt;.*?&lt;\/\\1&gt;/s', '', $message)));
+                if (!empty($textMsg)) {
+                        $this-&gt;AltBody = html_entity_decode($textMsg, ENT_QUOTES, $this-&gt;CharSet);
+                }
+        }
</ins><span class="cx">     if (empty($this-&gt;AltBody)) {
</span><span class="cx">       $this-&gt;AltBody = 'To view this email message, open it in a program that understands HTML!' . &quot;\n\n&quot;;
</span><span class="cx">     }
</span><ins>+        return $message;
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">   /**
</span></span></pre></div>
<a id="trunkwpincludesclasssmtpphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-smtp.php (19848 => 19849)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-smtp.php        2012-02-07 11:33:39 UTC (rev 19848)
+++ trunk/wp-includes/class-smtp.php        2012-02-07 16:13:51 UTC (rev 19849)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> /*~ class.smtp.php
</span><span class="cx"> .---------------------------------------------------------------------------.
</span><span class="cx"> |  Software: PHPMailer - PHP email class                                    |
</span><del>-|   Version: 5.2                                                            |
</del><ins>+|   Version: 5.2.1                                                          |
</ins><span class="cx"> |      Site: https://code.google.com/a/apache-extras.org/p/phpmailer/       |
</span><span class="cx"> | ------------------------------------------------------------------------- |
</span><span class="cx"> |     Admin: Jim Jagielski (project admininistrator)                        |
</span><span class="lines">@@ -10,7 +10,7 @@
</span><span class="cx"> |          : Marcus Bointon (coolbru) coolbru@users.sourceforge.net         |
</span><span class="cx"> |          : Jim Jagielski (jimjag) jimjag@gmail.com                        |
</span><span class="cx"> |   Founder: Brent R. Matzelle (original founder)                           |
</span><del>-| Copyright (c) 2010-2011, Jim Jagielski. All Rights Reserved.               |
</del><ins>+| Copyright (c) 2010-2012, Jim Jagielski. All Rights Reserved.              |
</ins><span class="cx"> | Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved.               |
</span><span class="cx"> | Copyright (c) 2001-2003, Brent R. Matzelle                                |
</span><span class="cx"> | ------------------------------------------------------------------------- |
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx">  * @author Marcus Bointon
</span><span class="cx">  * @copyright 2004 - 2008 Andy Prevost
</span><span class="cx">  * @author Jim Jagielski
</span><del>- * @copyright 2010 - 2011 Jim Jagielski
</del><ins>+ * @copyright 2010 - 2012 Jim Jagielski
</ins><span class="cx">  * @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
</span><span class="cx">  * @version $Id: class.smtp.php 450 2010-06-23 16:46:33Z coolbru $
</span><span class="cx">  */
</span><span class="lines">@@ -72,7 +72,7 @@
</span><span class="cx">    * Sets the SMTP PHPMailer Version number
</span><span class="cx">    * @var string
</span><span class="cx">    */
</span><del>-  public $Version         = '5.2';
</del><ins>+  public $Version         = '5.2.1';
</ins><span class="cx"> 
</span><span class="cx">   /////////////////////////////////////////////////
</span><span class="cx">   // PROPERTIES, PRIVATE AND PROTECTED
</span><span class="lines">@@ -797,7 +797,8 @@
</span><span class="cx">    */
</span><span class="cx">   private function get_lines() {
</span><span class="cx">     $data = &quot;&quot;;
</span><del>-    while($str = @fgets($this-&gt;smtp_conn,515)) {
</del><ins>+    while(!feof($this-&gt;smtp_conn)) {
+      $str = @fgets($this-&gt;smtp_conn,515);
</ins><span class="cx">       if($this-&gt;do_debug &gt;= 4) {
</span><span class="cx">         echo &quot;SMTP -&gt; get_lines(): \$data was \&quot;$data\&quot;&quot; . $this-&gt;CRLF . '&lt;br /&gt;';
</span><span class="cx">         echo &quot;SMTP -&gt; get_lines(): \$str is \&quot;$str\&quot;&quot; . $this-&gt;CRLF . '&lt;br /&gt;';
</span></span></pre>
</div>
</div>

</body>
</html>