<!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>[19632] trunk/wp-includes: Update PHPMailer to version 5.2.</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/19632">19632</a></dd>
<dt>Author</dt> <dd>westi</dd>
<dt>Date</dt> <dd>2011-12-28 12:59:13 +0000 (Wed, 28 Dec 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Update PHPMailer to version 5.2. See <a href="http://core.trac.wordpress.org/ticket/19677">#19677</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 (19631 => 19632)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-phpmailer.php        2011-12-25 17:27:39 UTC (rev 19631)
+++ trunk/wp-includes/class-phpmailer.php        2011-12-28 12:59:13 UTC (rev 19632)
</span><span class="lines">@@ -2,15 +2,15 @@
</span><span class="cx"> /*~ class.phpmailer.php
</span><span class="cx"> .---------------------------------------------------------------------------.
</span><span class="cx"> |  Software: PHPMailer - PHP email class                                    |
</span><del>-|   Version: 5.1                                                            |
-|   Contact: via sourceforge.net support pages (also www.worxware.com)      |
-|      Info: http://phpmailer.sourceforge.net                               |
-|   Support: http://sourceforge.net/projects/phpmailer/                     |
</del><ins>+|   Version: 5.2                                                            |
+|      Site: https://code.google.com/a/apache-extras.org/p/phpmailer/       |
</ins><span class="cx"> | ------------------------------------------------------------------------- |
</span><del>-|     Admin: Andy Prevost (project admininistrator)                         |
</del><ins>+|     Admin: Jim Jagielski (project admininistrator)                        |
</ins><span class="cx"> |   Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
</span><span class="cx"> |          : Marcus Bointon (coolbru) coolbru@users.sourceforge.net         |
</span><ins>+|          : Jim Jagielski (jimjag) jimjag@gmail.com                        |
</ins><span class="cx"> |   Founder: Brent R. Matzelle (original founder)                           |
</span><ins>+| Copyright (c) 2010-2011, 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">@@ -19,11 +19,6 @@
</span><span class="cx"> | This program is distributed in the hope that it will be useful - WITHOUT  |
</span><span class="cx"> | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     |
</span><span class="cx"> | FITNESS FOR A PARTICULAR PURPOSE.                                         |
</span><del>-| ------------------------------------------------------------------------- |
-| We offer a number of paid services (www.worxware.com):                    |
-| - Web Hosting on highly optimized fast and secure servers                 |
-| - Technology Consulting                                                   |
-| - Oursourcing (highly qualified programmers and graphic designers)        |
</del><span class="cx"> '---------------------------------------------------------------------------'
</span><span class="cx"> */
</span><span class="cx"> 
</span><span class="lines">@@ -33,8 +28,10 @@
</span><span class="cx">  * @package PHPMailer
</span><span class="cx">  * @author Andy Prevost
</span><span class="cx">  * @author Marcus Bointon
</span><ins>+ * @author Jim Jagielski
+ * @copyright 2010 - 2011 Jim Jagielski
</ins><span class="cx">  * @copyright 2004 - 2009 Andy Prevost
</span><del>- * @version $Id: class.phpmailer.php 447 2009-05-25 01:36:38Z codeworxtech $
</del><ins>+ * @version $Id: class.phpmailer.php 450 2010-06-23 16:46:33Z coolbru $
</ins><span class="cx">  * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="lines">@@ -119,6 +116,20 @@
</span><span class="cx">   public $AltBody           = '';
</span><span class="cx"> 
</span><span class="cx">   /**
</span><ins>+   * Stores the complete compiled MIME message body.
+   * @var string
+   * @access protected
+   */
+  protected $MIMEBody       = '';
+
+  /**
+   * Stores the complete compiled MIME message headers.
+   * @var string
+   * @access protected
+   */
+  protected $MIMEHeader     = '';
+
+  /**
</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">@@ -271,6 +282,12 @@
</span><span class="cx"> 
</span><span class="cx">   /**
</span><span class="cx">    * Used with DKIM DNS Resource Record
</span><ins>+   * @var string
+   */
+  public $DKIM_passphrase   = '';
+
+  /**
+   * Used with DKIM DNS Resource Record
</ins><span class="cx">    * optional, in format of email address 'you@yourdomain.com'
</span><span class="cx">    * @var string
</span><span class="cx">    */
</span><span class="lines">@@ -300,28 +317,34 @@
</span><span class="cx">    * Sets the PHPMailer Version number
</span><span class="cx">    * @var string
</span><span class="cx">    */
</span><del>-  public $Version         = '5.1';
</del><ins>+  public $Version         = '5.2';
</ins><span class="cx"> 
</span><ins>+  /**
+   * What to use in the X-Mailer header
+   * @var string
+   */
+  public $XMailer         = '';
+
</ins><span class="cx">   /////////////////////////////////////////////////
</span><span class="cx">   // PROPERTIES, PRIVATE AND PROTECTED
</span><span class="cx">   /////////////////////////////////////////////////
</span><span class="cx"> 
</span><del>-  private   $smtp           = NULL;
-  private   $to             = array();
-  private   $cc             = array();
-  private   $bcc            = array();
-  private   $ReplyTo        = array();
-  private   $all_recipients = array();
-  private   $attachment     = array();
-  private   $CustomHeader   = array();
-  private   $message_type   = '';
-  private   $boundary       = array();
-  protected $language       = array();
-  private   $error_count    = 0;
-  private   $sign_cert_file = &quot;&quot;;
-  private   $sign_key_file  = &quot;&quot;;
-  private   $sign_key_pass  = &quot;&quot;;
-  private   $exceptions     = false;
</del><ins>+  protected   $smtp           = NULL;
+  protected   $to             = array();
+  protected   $cc             = array();
+  protected   $bcc            = array();
+  protected   $ReplyTo        = array();
+  protected   $all_recipients = array();
+  protected   $attachment     = array();
+  protected   $CustomHeader   = array();
+  protected   $message_type   = '';
+  protected   $boundary       = array();
+  protected   $language       = array();
+  protected   $error_count    = 0;
+  protected   $sign_cert_file = '';
+  protected   $sign_key_file  = '';
+  protected   $sign_key_pass  = '';
+  protected   $exceptions     = false;
</ins><span class="cx"> 
</span><span class="cx">   /////////////////////////////////////////////////
</span><span class="cx">   // CONSTANTS
</span><span class="lines">@@ -447,11 +470,15 @@
</span><span class="cx">    * @param string $address The email address to send to
</span><span class="cx">    * @param string $name
</span><span class="cx">    * @return boolean true on success, false if address already used or invalid in some way
</span><del>-   * @access private
</del><ins>+   * @access protected
</ins><span class="cx">    */
</span><del>-  private function AddAnAddress($kind, $address, $name = '') {
</del><ins>+  protected function AddAnAddress($kind, $address, $name = '') {
</ins><span class="cx">     if (!preg_match('/^(to|cc|bcc|ReplyTo)$/', $kind)) {
</span><del>-      echo 'Invalid recipient array: ' . $kind;
</del><ins>+      $this-&gt;SetError($this-&gt;Lang('Invalid recipient array').': '.$kind);
+      if ($this-&gt;exceptions) {
+        throw new phpmailerException('Invalid recipient array: ' . $kind);
+      }
+      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">@@ -485,7 +512,7 @@
</span><span class="cx">  * @param string $name
</span><span class="cx">  * @return boolean
</span><span class="cx">  */
</span><del>-  public function SetFrom($address, $name = '',$auto=1) {
</del><ins>+  public function SetFrom($address, $name = '', $auto = 1) {
</ins><span class="cx">     $address = trim($address);
</span><span class="cx">     $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
</span><span class="cx">     if (!self::ValidateAddress($address)) {
</span><span class="lines">@@ -544,6 +571,19 @@
</span><span class="cx">    */
</span><span class="cx">   public function Send() {
</span><span class="cx">     try {
</span><ins>+      if(!$this-&gt;PreSend()) return false;
+      return $this-&gt;PostSend();
+    } catch (phpmailerException $e) {
+      $this-&gt;SetError($e-&gt;getMessage());
+      if ($this-&gt;exceptions) {
+        throw $e;
+      }
+      return false;
+    }
+  }
+
+  protected function PreSend() {
+    try {
</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">@@ -555,27 +595,41 @@
</span><span class="cx"> 
</span><span class="cx">       $this-&gt;error_count = 0; // reset errors
</span><span class="cx">       $this-&gt;SetMessageType();
</span><del>-      $header = $this-&gt;CreateHeader();
-      $body = $this-&gt;CreateBody();
-
</del><ins>+      //Refuse to send an empty message
</ins><span class="cx">       if (empty($this-&gt;Body)) {
</span><span class="cx">         throw new phpmailerException($this-&gt;Lang('empty_message'), self::STOP_CRITICAL);
</span><span class="cx">       }
</span><span class="cx"> 
</span><ins>+      $this-&gt;MIMEHeader = $this-&gt;CreateHeader();
+      $this-&gt;MIMEBody = $this-&gt;CreateBody();
+
+
</ins><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><del>-        $header_dkim = $this-&gt;DKIM_Add($header,$this-&gt;Subject,$body);
-        $header = str_replace(&quot;\r\n&quot;,&quot;\n&quot;,$header_dkim) . $header;
</del><ins>+        $header_dkim = $this-&gt;DKIM_Add($this-&gt;MIMEHeader, $this-&gt;EncodeHeader($this-&gt;SecureHeader($this-&gt;Subject)), $this-&gt;MIMEBody);
+        $this-&gt;MIMEHeader = str_replace(&quot;\r\n&quot;, &quot;\n&quot;, $header_dkim) . $this-&gt;MIMEHeader;
</ins><span class="cx">       }
</span><span class="cx"> 
</span><ins>+      return true;
+    } catch (phpmailerException $e) {
+      $this-&gt;SetError($e-&gt;getMessage());
+      if ($this-&gt;exceptions) {
+        throw $e;
+      }
+      return false;
+    }
+  }
+
+  protected function PostSend() {
+    try {
</ins><span class="cx">       // Choose the mailer and send through it
</span><span class="cx">       switch($this-&gt;Mailer) {
</span><span class="cx">         case 'sendmail':
</span><del>-          return $this-&gt;SendmailSend($header, $body);
</del><ins>+          return $this-&gt;SendmailSend($this-&gt;MIMEHeader, $this-&gt;MIMEBody);
</ins><span class="cx">         case 'smtp':
</span><del>-          return $this-&gt;SmtpSend($header, $body);
</del><ins>+          return $this-&gt;SmtpSend($this-&gt;MIMEHeader, $this-&gt;MIMEBody);
</ins><span class="cx">         default:
</span><del>-          return $this-&gt;MailSend($header, $body);
</del><ins>+          return $this-&gt;MailSend($this-&gt;MIMEHeader, $this-&gt;MIMEBody);
</ins><span class="cx">       }
</span><span class="cx"> 
</span><span class="cx">     } catch (phpmailerException $e) {
</span><span class="lines">@@ -612,7 +666,7 @@
</span><span class="cx">         $result = pclose($mail);
</span><span class="cx">         // implement call back function if it exists
</span><span class="cx">         $isSent = ($result == 0) ? 1 : 0;
</span><del>-        $this-&gt;doCallback($isSent,$val,$this-&gt;cc,$this-&gt;bcc,$this-&gt;Subject,$body);
</del><ins>+        $this-&gt;doCallback($isSent, $val, $this-&gt;cc, $this-&gt;bcc, $this-&gt;Subject, $body);
</ins><span class="cx">         if($result != 0) {
</span><span class="cx">           throw new phpmailerException($this-&gt;Lang('execute') . $this-&gt;Sendmail, self::STOP_CRITICAL);
</span><span class="cx">         }
</span><span class="lines">@@ -626,7 +680,7 @@
</span><span class="cx">       $result = pclose($mail);
</span><span class="cx">       // implement call back function if it exists
</span><span class="cx">       $isSent = ($result == 0) ? 1 : 0;
</span><del>-      $this-&gt;doCallback($isSent,$this-&gt;to,$this-&gt;cc,$this-&gt;bcc,$this-&gt;Subject,$body);
</del><ins>+      $this-&gt;doCallback($isSent, $this-&gt;to, $this-&gt;cc, $this-&gt;bcc, $this-&gt;Subject, $body);
</ins><span class="cx">       if($result != 0) {
</span><span class="cx">         throw new phpmailerException($this-&gt;Lang('execute') . $this-&gt;Sendmail, self::STOP_CRITICAL);
</span><span class="cx">       }
</span><span class="lines">@@ -648,8 +702,12 @@
</span><span class="cx">     }
</span><span class="cx">     $to = implode(', ', $toArr);
</span><span class="cx"> 
</span><del>-    $params = sprintf(&quot;-oi -f %s&quot;, $this-&gt;Sender);
-    if ($this-&gt;Sender != '' &amp;&amp; strlen(ini_get('safe_mode'))&lt; 1) {
</del><ins>+    if (empty($this-&gt;Sender)) {
+      $params = &quot;-oi -f %s&quot;;
+    } else {
+      $params = sprintf(&quot;-oi -f %s&quot;, $this-&gt;Sender);
+    }
+    if ($this-&gt;Sender != '' and !ini_get('safe_mode')) {
</ins><span class="cx">       $old_from = ini_get('sendmail_from');
</span><span class="cx">       ini_set('sendmail_from', $this-&gt;Sender);
</span><span class="cx">       if ($this-&gt;SingleTo === true &amp;&amp; count($toArr) &gt; 1) {
</span><span class="lines">@@ -657,13 +715,13 @@
</span><span class="cx">           $rt = @mail($val, $this-&gt;EncodeHeader($this-&gt;SecureHeader($this-&gt;Subject)), $body, $header, $params);
</span><span class="cx">           // implement call back function if it exists
</span><span class="cx">           $isSent = ($rt == 1) ? 1 : 0;
</span><del>-          $this-&gt;doCallback($isSent,$val,$this-&gt;cc,$this-&gt;bcc,$this-&gt;Subject,$body);
</del><ins>+          $this-&gt;doCallback($isSent, $val, $this-&gt;cc, $this-&gt;bcc, $this-&gt;Subject, $body);
</ins><span class="cx">         }
</span><span class="cx">       } else {
</span><span class="cx">         $rt = @mail($to, $this-&gt;EncodeHeader($this-&gt;SecureHeader($this-&gt;Subject)), $body, $header, $params);
</span><span class="cx">         // implement call back function if it exists
</span><span class="cx">         $isSent = ($rt == 1) ? 1 : 0;
</span><del>-        $this-&gt;doCallback($isSent,$to,$this-&gt;cc,$this-&gt;bcc,$this-&gt;Subject,$body);
</del><ins>+        $this-&gt;doCallback($isSent, $to, $this-&gt;cc, $this-&gt;bcc, $this-&gt;Subject, $body);
</ins><span class="cx">       }
</span><span class="cx">     } else {
</span><span class="cx">       if ($this-&gt;SingleTo === true &amp;&amp; count($toArr) &gt; 1) {
</span><span class="lines">@@ -671,13 +729,13 @@
</span><span class="cx">           $rt = @mail($val, $this-&gt;EncodeHeader($this-&gt;SecureHeader($this-&gt;Subject)), $body, $header, $params);
</span><span class="cx">           // implement call back function if it exists
</span><span class="cx">           $isSent = ($rt == 1) ? 1 : 0;
</span><del>-          $this-&gt;doCallback($isSent,$val,$this-&gt;cc,$this-&gt;bcc,$this-&gt;Subject,$body);
</del><ins>+          $this-&gt;doCallback($isSent, $val, $this-&gt;cc, $this-&gt;bcc, $this-&gt;Subject, $body);
</ins><span class="cx">         }
</span><span class="cx">       } else {
</span><span class="cx">         $rt = @mail($to, $this-&gt;EncodeHeader($this-&gt;SecureHeader($this-&gt;Subject)), $body, $header);
</span><span class="cx">         // implement call back function if it exists
</span><span class="cx">         $isSent = ($rt == 1) ? 1 : 0;
</span><del>-        $this-&gt;doCallback($isSent,$to,$this-&gt;cc,$this-&gt;bcc,$this-&gt;Subject,$body);
</del><ins>+        $this-&gt;doCallback($isSent, $to, $this-&gt;cc, $this-&gt;bcc, $this-&gt;Subject, $body);
</ins><span class="cx">       }
</span><span class="cx">     }
</span><span class="cx">     if (isset($old_from)) {
</span><span class="lines">@@ -699,7 +757,7 @@
</span><span class="cx">    * @return bool
</span><span class="cx">    */
</span><span class="cx">   protected function SmtpSend($header, $body) {
</span><del>-    require_once $this-&gt;PluginDir . 'class-smtp.php';
</del><ins>+    require_once $this-&gt;PluginDir . 'class.smtp.php';
</ins><span class="cx">     $bad_rcpt = array();
</span><span class="cx"> 
</span><span class="cx">     if(!$this-&gt;SmtpConnect()) {
</span><span class="lines">@@ -716,11 +774,11 @@
</span><span class="cx">         $bad_rcpt[] = $to[0];
</span><span class="cx">         // implement call back function if it exists
</span><span class="cx">         $isSent = 0;
</span><del>-        $this-&gt;doCallback($isSent,$to[0],'','',$this-&gt;Subject,$body);
</del><ins>+        $this-&gt;doCallback($isSent, $to[0], '', '', $this-&gt;Subject, $body);
</ins><span class="cx">       } else {
</span><span class="cx">         // implement call back function if it exists
</span><span class="cx">         $isSent = 1;
</span><del>-        $this-&gt;doCallback($isSent,$to[0],'','',$this-&gt;Subject,$body);
</del><ins>+        $this-&gt;doCallback($isSent, $to[0], '', '', $this-&gt;Subject, $body);
</ins><span class="cx">       }
</span><span class="cx">     }
</span><span class="cx">     foreach($this-&gt;cc as $cc) {
</span><span class="lines">@@ -728,11 +786,11 @@
</span><span class="cx">         $bad_rcpt[] = $cc[0];
</span><span class="cx">         // implement call back function if it exists
</span><span class="cx">         $isSent = 0;
</span><del>-        $this-&gt;doCallback($isSent,'',$cc[0],'',$this-&gt;Subject,$body);
</del><ins>+        $this-&gt;doCallback($isSent, '', $cc[0], '', $this-&gt;Subject, $body);
</ins><span class="cx">       } else {
</span><span class="cx">         // implement call back function if it exists
</span><span class="cx">         $isSent = 1;
</span><del>-        $this-&gt;doCallback($isSent,'',$cc[0],'',$this-&gt;Subject,$body);
</del><ins>+        $this-&gt;doCallback($isSent, '', $cc[0], '', $this-&gt;Subject, $body);
</ins><span class="cx">       }
</span><span class="cx">     }
</span><span class="cx">     foreach($this-&gt;bcc as $bcc) {
</span><span class="lines">@@ -740,11 +798,11 @@
</span><span class="cx">         $bad_rcpt[] = $bcc[0];
</span><span class="cx">         // implement call back function if it exists
</span><span class="cx">         $isSent = 0;
</span><del>-        $this-&gt;doCallback($isSent,'','',$bcc[0],$this-&gt;Subject,$body);
</del><ins>+        $this-&gt;doCallback($isSent, '', '', $bcc[0], $this-&gt;Subject, $body);
</ins><span class="cx">       } else {
</span><span class="cx">         // implement call back function if it exists
</span><span class="cx">         $isSent = 1;
</span><del>-        $this-&gt;doCallback($isSent,'','',$bcc[0],$this-&gt;Subject,$body);
</del><ins>+        $this-&gt;doCallback($isSent, '', '', $bcc[0], $this-&gt;Subject, $body);
</ins><span class="cx">       }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -942,7 +1000,7 @@
</span><span class="cx"> 
</span><span class="cx">     $line = explode($this-&gt;LE, $message);
</span><span class="cx">     $message = '';
</span><del>-    for ($i=0 ;$i &lt; count($line); $i++) {
</del><ins>+    for ($i = 0 ;$i &lt; count($line); $i++) {
</ins><span class="cx">       $line_part = explode(' ', $line[$i]);
</span><span class="cx">       $buf = '';
</span><span class="cx">       for ($e = 0; $e&lt;count($line_part); $e++) {
</span><span class="lines">@@ -1056,7 +1114,9 @@
</span><span class="cx"> 
</span><span class="cx">     switch($this-&gt;message_type) {
</span><span class="cx">       case 'alt':
</span><del>-      case 'alt_attachments':
</del><ins>+      case 'alt_inline':
+      case 'alt_attach':
+      case 'alt_inline_attach':
</ins><span class="cx">         $this-&gt;AltBody = $this-&gt;WrapText($this-&gt;AltBody, $this-&gt;WordWrap);
</span><span class="cx">         break;
</span><span class="cx">       default:
</span><span class="lines">@@ -1077,6 +1137,7 @@
</span><span class="cx">     $uniq_id = md5(uniqid(time()));
</span><span class="cx">     $this-&gt;boundary[1] = 'b1_' . $uniq_id;
</span><span class="cx">     $this-&gt;boundary[2] = 'b2_' . $uniq_id;
</span><ins>+    $this-&gt;boundary[3] = 'b3_' . $uniq_id;
</ins><span class="cx"> 
</span><span class="cx">     $result .= $this-&gt;HeaderLine('Date', self::RFCDate());
</span><span class="cx">     if($this-&gt;Sender == '') {
</span><span class="lines">@@ -1125,12 +1186,16 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if($this-&gt;MessageID != '') {
</span><del>-      $result .= $this-&gt;HeaderLine('Message-ID',$this-&gt;MessageID);
</del><ins>+      $result .= $this-&gt;HeaderLine('Message-ID', $this-&gt;MessageID);
</ins><span class="cx">     } else {
</span><span class="cx">       $result .= sprintf(&quot;Message-ID: &lt;%s@%s&gt;%s&quot;, $uniq_id, $this-&gt;ServerHostname(), $this-&gt;LE);
</span><span class="cx">     }
</span><span class="cx">     $result .= $this-&gt;HeaderLine('X-Priority', $this-&gt;Priority);
</span><del>-    $result .= $this-&gt;HeaderLine('X-Mailer', 'PHPMailer '.$this-&gt;Version.' (phpmailer.sourceforge.net)');
</del><ins>+    if($this-&gt;XMailer) {
+      $result .= $this-&gt;HeaderLine('X-Mailer', $this-&gt;XMailer);
+    } else {
+      $result .= $this-&gt;HeaderLine('X-Mailer', 'PHPMailer '.$this-&gt;Version.' (http://code.google.com/a/apache-extras.org/p/phpmailer/)');
+    }
</ins><span class="cx"> 
</span><span class="cx">     if($this-&gt;ConfirmReadingTo != '') {
</span><span class="cx">       $result .= $this-&gt;HeaderLine('Disposition-Notification-To', '&lt;' . trim($this-&gt;ConfirmReadingTo) . '&gt;');
</span><span class="lines">@@ -1158,18 +1223,21 @@
</span><span class="cx">     switch($this-&gt;message_type) {
</span><span class="cx">       case 'plain':
</span><span class="cx">         $result .= $this-&gt;HeaderLine('Content-Transfer-Encoding', $this-&gt;Encoding);
</span><del>-        $result .= sprintf(&quot;Content-Type: %s; charset=\&quot;%s\&quot;&quot;, $this-&gt;ContentType, $this-&gt;CharSet);
</del><ins>+        $result .= $this-&gt;TextLine('Content-Type: '.$this-&gt;ContentType.'; charset=&quot;'.$this-&gt;CharSet.'&quot;');
</ins><span class="cx">         break;
</span><del>-      case 'attachments':
-      case 'alt_attachments':
-        if($this-&gt;InlineImageExists()){
-          $result .= sprintf(&quot;Content-Type: %s;%s\ttype=\&quot;text/html\&quot;;%s\tboundary=\&quot;%s\&quot;%s&quot;, 'multipart/related', $this-&gt;LE, $this-&gt;LE, $this-&gt;boundary[1], $this-&gt;LE);
-        } else {
-          $result .= $this-&gt;HeaderLine('Content-Type', 'multipart/mixed;');
-          $result .= $this-&gt;TextLine(&quot;\tboundary=\&quot;&quot; . $this-&gt;boundary[1] . '&quot;');
-        }
</del><ins>+      case 'inline':
+        $result .= $this-&gt;HeaderLine('Content-Type', 'multipart/related;');
+        $result .= $this-&gt;TextLine(&quot;\tboundary=\&quot;&quot; . $this-&gt;boundary[1] . '&quot;');
</ins><span class="cx">         break;
</span><ins>+      case 'attach':
+      case 'inline_attach':
+      case 'alt_attach':
+      case 'alt_inline_attach':
+        $result .= $this-&gt;HeaderLine('Content-Type', 'multipart/mixed;');
+        $result .= $this-&gt;TextLine(&quot;\tboundary=\&quot;&quot; . $this-&gt;boundary[1] . '&quot;');
+        break;
</ins><span class="cx">       case 'alt':
</span><ins>+      case 'alt_inline':
</ins><span class="cx">         $result .= $this-&gt;HeaderLine('Content-Type', 'multipart/alternative;');
</span><span class="cx">         $result .= $this-&gt;TextLine(&quot;\tboundary=\&quot;&quot; . $this-&gt;boundary[1] . '&quot;');
</span><span class="cx">         break;
</span><span class="lines">@@ -1197,6 +1265,33 @@
</span><span class="cx">     $this-&gt;SetWordWrap();
</span><span class="cx"> 
</span><span class="cx">     switch($this-&gt;message_type) {
</span><ins>+      case 'plain':
+        $body .= $this-&gt;EncodeString($this-&gt;Body, $this-&gt;Encoding);
+        break;
+      case 'inline':
+        $body .= $this-&gt;GetBoundary($this-&gt;boundary[1], '', '', '');
+        $body .= $this-&gt;EncodeString($this-&gt;Body, $this-&gt;Encoding);
+        $body .= $this-&gt;LE.$this-&gt;LE;
+        $body .= $this-&gt;AttachAll(&quot;inline&quot;, $this-&gt;boundary[1]);
+        break;
+      case 'attach':
+        $body .= $this-&gt;GetBoundary($this-&gt;boundary[1], '', '', '');
+        $body .= $this-&gt;EncodeString($this-&gt;Body, $this-&gt;Encoding);
+        $body .= $this-&gt;LE.$this-&gt;LE;
+        $body .= $this-&gt;AttachAll(&quot;attachment&quot;, $this-&gt;boundary[1]);
+        break;
+      case 'inline_attach':
+        $body .= $this-&gt;TextLine(&quot;--&quot; . $this-&gt;boundary[1]);
+        $body .= $this-&gt;HeaderLine('Content-Type', 'multipart/related;');
+        $body .= $this-&gt;TextLine(&quot;\tboundary=\&quot;&quot; . $this-&gt;boundary[2] . '&quot;');
+        $body .= $this-&gt;LE;
+        $body .= $this-&gt;GetBoundary($this-&gt;boundary[2], '', '', '');
+        $body .= $this-&gt;EncodeString($this-&gt;Body, $this-&gt;Encoding);
+        $body .= $this-&gt;LE.$this-&gt;LE;
+        $body .= $this-&gt;AttachAll(&quot;inline&quot;, $this-&gt;boundary[2]);
+        $body .= $this-&gt;LE;
+        $body .= $this-&gt;AttachAll(&quot;attachment&quot;, $this-&gt;boundary[1]);
+        break;
</ins><span class="cx">       case 'alt':
</span><span class="cx">         $body .= $this-&gt;GetBoundary($this-&gt;boundary[1], '', 'text/plain', '');
</span><span class="cx">         $body .= $this-&gt;EncodeString($this-&gt;AltBody, $this-&gt;Encoding);
</span><span class="lines">@@ -1206,26 +1301,56 @@
</span><span class="cx">         $body .= $this-&gt;LE.$this-&gt;LE;
</span><span class="cx">         $body .= $this-&gt;EndBoundary($this-&gt;boundary[1]);
</span><span class="cx">         break;
</span><del>-      case 'plain':
</del><ins>+      case 'alt_inline':
+        $body .= $this-&gt;GetBoundary($this-&gt;boundary[1], '', 'text/plain', '');
+        $body .= $this-&gt;EncodeString($this-&gt;AltBody, $this-&gt;Encoding);
+        $body .= $this-&gt;LE.$this-&gt;LE;
+        $body .= $this-&gt;TextLine(&quot;--&quot; . $this-&gt;boundary[1]);
+        $body .= $this-&gt;HeaderLine('Content-Type', 'multipart/related;');
+        $body .= $this-&gt;TextLine(&quot;\tboundary=\&quot;&quot; . $this-&gt;boundary[2] . '&quot;');
+        $body .= $this-&gt;LE;
+        $body .= $this-&gt;GetBoundary($this-&gt;boundary[2], '', 'text/html', '');
</ins><span class="cx">         $body .= $this-&gt;EncodeString($this-&gt;Body, $this-&gt;Encoding);
</span><ins>+        $body .= $this-&gt;LE.$this-&gt;LE;
+        $body .= $this-&gt;AttachAll(&quot;inline&quot;, $this-&gt;boundary[2]);
+        $body .= $this-&gt;LE;
+        $body .= $this-&gt;EndBoundary($this-&gt;boundary[1]);
</ins><span class="cx">         break;
</span><del>-      case 'attachments':
-        $body .= $this-&gt;GetBoundary($this-&gt;boundary[1], '', '', '');
</del><ins>+      case 'alt_attach':
+        $body .= $this-&gt;TextLine(&quot;--&quot; . $this-&gt;boundary[1]);
+        $body .= $this-&gt;HeaderLine('Content-Type', 'multipart/alternative;');
+        $body .= $this-&gt;TextLine(&quot;\tboundary=\&quot;&quot; . $this-&gt;boundary[2] . '&quot;');
+        $body .= $this-&gt;LE;
+        $body .= $this-&gt;GetBoundary($this-&gt;boundary[2], '', 'text/plain', '');
+        $body .= $this-&gt;EncodeString($this-&gt;AltBody, $this-&gt;Encoding);
+        $body .= $this-&gt;LE.$this-&gt;LE;
+        $body .= $this-&gt;GetBoundary($this-&gt;boundary[2], '', 'text/html', '');
</ins><span class="cx">         $body .= $this-&gt;EncodeString($this-&gt;Body, $this-&gt;Encoding);
</span><ins>+        $body .= $this-&gt;LE.$this-&gt;LE;
+        $body .= $this-&gt;EndBoundary($this-&gt;boundary[2]);
</ins><span class="cx">         $body .= $this-&gt;LE;
</span><del>-        $body .= $this-&gt;AttachAll();
</del><ins>+        $body .= $this-&gt;AttachAll(&quot;attachment&quot;, $this-&gt;boundary[1]);
</ins><span class="cx">         break;
</span><del>-      case 'alt_attachments':
-        $body .= sprintf(&quot;--%s%s&quot;, $this-&gt;boundary[1], $this-&gt;LE);
-        $body .= sprintf(&quot;Content-Type: %s;%s&quot; . &quot;\tboundary=\&quot;%s\&quot;%s&quot;, 'multipart/alternative', $this-&gt;LE, $this-&gt;boundary[2], $this-&gt;LE.$this-&gt;LE);
-        $body .= $this-&gt;GetBoundary($this-&gt;boundary[2], '', 'text/plain', '') . $this-&gt;LE; // Create text body
</del><ins>+      case 'alt_inline_attach':
+        $body .= $this-&gt;TextLine(&quot;--&quot; . $this-&gt;boundary[1]);
+        $body .= $this-&gt;HeaderLine('Content-Type', 'multipart/alternative;');
+        $body .= $this-&gt;TextLine(&quot;\tboundary=\&quot;&quot; . $this-&gt;boundary[2] . '&quot;');
+        $body .= $this-&gt;LE;
+        $body .= $this-&gt;GetBoundary($this-&gt;boundary[2], '', 'text/plain', '');
</ins><span class="cx">         $body .= $this-&gt;EncodeString($this-&gt;AltBody, $this-&gt;Encoding);
</span><span class="cx">         $body .= $this-&gt;LE.$this-&gt;LE;
</span><del>-        $body .= $this-&gt;GetBoundary($this-&gt;boundary[2], '', 'text/html', '') . $this-&gt;LE; // Create the HTML body
</del><ins>+        $body .= $this-&gt;TextLine(&quot;--&quot; . $this-&gt;boundary[2]);
+        $body .= $this-&gt;HeaderLine('Content-Type', 'multipart/related;');
+        $body .= $this-&gt;TextLine(&quot;\tboundary=\&quot;&quot; . $this-&gt;boundary[3] . '&quot;');
+        $body .= $this-&gt;LE;
+        $body .= $this-&gt;GetBoundary($this-&gt;boundary[3], '', 'text/html', '');
</ins><span class="cx">         $body .= $this-&gt;EncodeString($this-&gt;Body, $this-&gt;Encoding);
</span><span class="cx">         $body .= $this-&gt;LE.$this-&gt;LE;
</span><ins>+        $body .= $this-&gt;AttachAll(&quot;inline&quot;, $this-&gt;boundary[3]);
+        $body .= $this-&gt;LE;
</ins><span class="cx">         $body .= $this-&gt;EndBoundary($this-&gt;boundary[2]);
</span><del>-        $body .= $this-&gt;AttachAll();
</del><ins>+        $body .= $this-&gt;LE;
+        $body .= $this-&gt;AttachAll(&quot;attachment&quot;, $this-&gt;boundary[1]);
</ins><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1258,9 +1383,10 @@
</span><span class="cx"> 
</span><span class="cx">   /**
</span><span class="cx">    * Returns the start of a message boundary.
</span><del>-   * @access private
</del><ins>+   * @access protected
+   * @return string
</ins><span class="cx">    */
</span><del>-  private function GetBoundary($boundary, $charSet, $contentType, $encoding) {
</del><ins>+  protected function GetBoundary($boundary, $charSet, $contentType, $encoding) {
</ins><span class="cx">     $result = '';
</span><span class="cx">     if($charSet == '') {
</span><span class="cx">       $charSet = $this-&gt;CharSet;
</span><span class="lines">@@ -1272,7 +1398,7 @@
</span><span class="cx">       $encoding = $this-&gt;Encoding;
</span><span class="cx">     }
</span><span class="cx">     $result .= $this-&gt;TextLine('--' . $boundary);
</span><del>-    $result .= sprintf(&quot;Content-Type: %s; charset = \&quot;%s\&quot;&quot;, $contentType, $charSet);
</del><ins>+    $result .= sprintf(&quot;Content-Type: %s; charset=\&quot;%s\&quot;&quot;, $contentType, $charSet);
</ins><span class="cx">     $result .= $this-&gt;LE;
</span><span class="cx">     $result .= $this-&gt;HeaderLine('Content-Transfer-Encoding', $encoding);
</span><span class="cx">     $result .= $this-&gt;LE;
</span><span class="lines">@@ -1282,31 +1408,25 @@
</span><span class="cx"> 
</span><span class="cx">   /**
</span><span class="cx">    * Returns the end of a message boundary.
</span><del>-   * @access private
</del><ins>+   * @access protected
+   * @return string
</ins><span class="cx">    */
</span><del>-  private function EndBoundary($boundary) {
</del><ins>+  protected function EndBoundary($boundary) {
</ins><span class="cx">     return $this-&gt;LE . '--' . $boundary . '--' . $this-&gt;LE;
</span><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">   /**
</span><span class="cx">    * Sets the message type.
</span><del>-   * @access private
</del><ins>+   * @access protected
</ins><span class="cx">    * @return void
</span><span class="cx">    */
</span><del>-  private function SetMessageType() {
-    if(count($this-&gt;attachment) &lt; 1 &amp;&amp; strlen($this-&gt;AltBody) &lt; 1) {
-      $this-&gt;message_type = 'plain';
-    } else {
-      if(count($this-&gt;attachment) &gt; 0) {
-        $this-&gt;message_type = 'attachments';
-      }
-      if(strlen($this-&gt;AltBody) &gt; 0 &amp;&amp; count($this-&gt;attachment) &lt; 1) {
-        $this-&gt;message_type = 'alt';
-      }
-      if(strlen($this-&gt;AltBody) &gt; 0 &amp;&amp; count($this-&gt;attachment) &gt; 0) {
-        $this-&gt;message_type = 'alt_attachments';
-      }
-    }
</del><ins>+  protected function SetMessageType() {
+    $this-&gt;message_type = array();
+    if($this-&gt;AlternativeExists()) $this-&gt;message_type[] = &quot;alt&quot;;
+    if($this-&gt;InlineImageExists()) $this-&gt;message_type[] = &quot;inline&quot;;
+    if($this-&gt;AttachmentExists()) $this-&gt;message_type[] = &quot;attach&quot;;
+    $this-&gt;message_type = implode(&quot;_&quot;, $this-&gt;message_type);
+    if($this-&gt;message_type == &quot;&quot;) $this-&gt;message_type = &quot;plain&quot;;
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">   /**
</span><span class="lines">@@ -1386,10 +1506,10 @@
</span><span class="cx">   /**
</span><span class="cx">    * Attaches all fs, string, and binary attachments to the message.
</span><span class="cx">    * Returns an empty string on failure.
</span><del>-   * @access private
</del><ins>+   * @access protected
</ins><span class="cx">    * @return string
</span><span class="cx">    */
</span><del>-  private function AttachAll() {
</del><ins>+  protected function AttachAll($disposition_type, $boundary) {
</ins><span class="cx">     // Return text of body
</span><span class="cx">     $mime = array();
</span><span class="cx">     $cidUniq = array();
</span><span class="lines">@@ -1397,54 +1517,58 @@
</span><span class="cx"> 
</span><span class="cx">     // Add all attachments
</span><span class="cx">     foreach ($this-&gt;attachment as $attachment) {
</span><del>-      // Check for string attachment
-      $bString = $attachment[5];
-      if ($bString) {
-        $string = $attachment[0];
-      } else {
-        $path = $attachment[0];
-      }
</del><ins>+      // CHECK IF IT IS A VALID DISPOSITION_FILTER
+      if($attachment[6] == $disposition_type) {
+        // Check for string attachment
+        $bString = $attachment[5];
+        if ($bString) {
+          $string = $attachment[0];
+        } else {
+          $path = $attachment[0];
+        }
</ins><span class="cx"> 
</span><del>-      if (in_array($attachment[0], $incl)) { continue; }
-      $filename    = $attachment[1];
-      $name        = $attachment[2];
-      $encoding    = $attachment[3];
-      $type        = $attachment[4];
-      $disposition = $attachment[6];
-      $cid         = $attachment[7];
-      $incl[]      = $attachment[0];
-      if ( $disposition == 'inline' &amp;&amp; isset($cidUniq[$cid]) ) { continue; }
-      $cidUniq[$cid] = true;
</del><ins>+        $inclhash = md5(serialize($attachment));
+        if (in_array($inclhash, $incl)) { continue; }
+        $incl[]      = $inclhash;
+        $filename    = $attachment[1];
+        $name        = $attachment[2];
+        $encoding    = $attachment[3];
+        $type        = $attachment[4];
+        $disposition = $attachment[6];
+        $cid         = $attachment[7];
+        if ( $disposition == 'inline' &amp;&amp; isset($cidUniq[$cid]) ) { continue; }
+        $cidUniq[$cid] = true;
</ins><span class="cx"> 
</span><del>-      $mime[] = sprintf(&quot;--%s%s&quot;, $this-&gt;boundary[1], $this-&gt;LE);
-      $mime[] = sprintf(&quot;Content-Type: %s; name=\&quot;%s\&quot;%s&quot;, $type, $this-&gt;EncodeHeader($this-&gt;SecureHeader($name)), $this-&gt;LE);
-      $mime[] = sprintf(&quot;Content-Transfer-Encoding: %s%s&quot;, $encoding, $this-&gt;LE);
</del><ins>+        $mime[] = sprintf(&quot;--%s%s&quot;, $boundary, $this-&gt;LE);
+        $mime[] = sprintf(&quot;Content-Type: %s; name=\&quot;%s\&quot;%s&quot;, $type, $this-&gt;EncodeHeader($this-&gt;SecureHeader($name)), $this-&gt;LE);
+        $mime[] = sprintf(&quot;Content-Transfer-Encoding: %s%s&quot;, $encoding, $this-&gt;LE);
</ins><span class="cx"> 
</span><del>-      if($disposition == 'inline') {
-        $mime[] = sprintf(&quot;Content-ID: &lt;%s&gt;%s&quot;, $cid, $this-&gt;LE);
-      }
</del><ins>+        if($disposition == 'inline') {
+          $mime[] = sprintf(&quot;Content-ID: &lt;%s&gt;%s&quot;, $cid, $this-&gt;LE);
+        }
</ins><span class="cx"> 
</span><del>-      $mime[] = sprintf(&quot;Content-Disposition: %s; filename=\&quot;%s\&quot;%s&quot;, $disposition, $this-&gt;EncodeHeader($this-&gt;SecureHeader($name)), $this-&gt;LE.$this-&gt;LE);
</del><ins>+        $mime[] = sprintf(&quot;Content-Disposition: %s; filename=\&quot;%s\&quot;%s&quot;, $disposition, $this-&gt;EncodeHeader($this-&gt;SecureHeader($name)), $this-&gt;LE.$this-&gt;LE);
</ins><span class="cx"> 
</span><del>-      // Encode as string attachment
-      if($bString) {
-        $mime[] = $this-&gt;EncodeString($string, $encoding);
-        if($this-&gt;IsError()) {
-          return '';
</del><ins>+        // Encode as string attachment
+        if($bString) {
+          $mime[] = $this-&gt;EncodeString($string, $encoding);
+          if($this-&gt;IsError()) {
+            return '';
+          }
+          $mime[] = $this-&gt;LE.$this-&gt;LE;
+        } else {
+          $mime[] = $this-&gt;EncodeFile($path, $encoding);
+          if($this-&gt;IsError()) {
+            return '';
+          }
+          $mime[] = $this-&gt;LE.$this-&gt;LE;
</ins><span class="cx">         }
</span><del>-        $mime[] = $this-&gt;LE.$this-&gt;LE;
-      } else {
-        $mime[] = $this-&gt;EncodeFile($path, $encoding);
-        if($this-&gt;IsError()) {
-          return '';
-        }
-        $mime[] = $this-&gt;LE.$this-&gt;LE;
</del><span class="cx">       }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    $mime[] = sprintf(&quot;--%s--%s&quot;, $this-&gt;boundary[1], $this-&gt;LE);
</del><ins>+    $mime[] = sprintf(&quot;--%s--%s&quot;, $boundary, $this-&gt;LE);
</ins><span class="cx"> 
</span><del>-    return join('', $mime);
</del><ins>+    return implode(&quot;&quot;, $mime);
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">   /**
</span><span class="lines">@@ -1453,10 +1577,10 @@
</span><span class="cx">    * @param string $path The full path to the file
</span><span class="cx">    * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
</span><span class="cx">    * @see EncodeFile()
</span><del>-   * @access private
</del><ins>+   * @access protected
</ins><span class="cx">    * @return string
</span><span class="cx">    */
</span><del>-  private function EncodeFile($path, $encoding = 'base64') {
</del><ins>+  protected function EncodeFile($path, $encoding = 'base64') {
</ins><span class="cx">     try {
</span><span class="cx">       if (!is_readable($path)) {
</span><span class="cx">         throw new phpmailerException($this-&gt;Lang('file_open') . $path, self::STOP_CONTINUE);
</span><span class="lines">@@ -1466,13 +1590,15 @@
</span><span class="cx">           return false;
</span><span class="cx">         }
</span><span class="cx">       }
</span><del>-      if (PHP_VERSION &lt; 6) {
</del><ins>+      if (version_compare(PHP_VERSION, '5.3.0', '&lt;')) {
</ins><span class="cx">         $magic_quotes = get_magic_quotes_runtime();
</span><span class="cx">         set_magic_quotes_runtime(0);
</span><span class="cx">       }
</span><span class="cx">       $file_buffer  = file_get_contents($path);
</span><span class="cx">       $file_buffer  = $this-&gt;EncodeString($file_buffer, $encoding);
</span><del>-      if (PHP_VERSION &lt; 6) { set_magic_quotes_runtime($magic_quotes); }
</del><ins>+      if (version_compare(PHP_VERSION, '5.3.0', '&lt;')) {
+        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">@@ -1488,7 +1614,7 @@
</span><span class="cx">    * @access public
</span><span class="cx">    * @return string
</span><span class="cx">    */
</span><del>-  public function EncodeString ($str, $encoding = 'base64') {
</del><ins>+  public function EncodeString($str, $encoding = 'base64') {
</ins><span class="cx">     $encoded = '';
</span><span class="cx">     switch(strtolower($encoding)) {
</span><span class="cx">       case 'base64':
</span><span class="lines">@@ -1637,7 +1763,7 @@
</span><span class="cx">   * @return string
</span><span class="cx">   */
</span><span class="cx">   public function EncodeQPphp( $input = '', $line_max = 76, $space_conv = false) {
</span><del>-    $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
</del><ins>+    $hex = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
</ins><span class="cx">     $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
</span><span class="cx">     $eol = &quot;\r\n&quot;;
</span><span class="cx">     $escape = '=';
</span><span class="lines">@@ -1718,7 +1844,7 @@
</span><span class="cx">    * @access public
</span><span class="cx">    * @return string
</span><span class="cx">    */
</span><del>-  public function EncodeQ ($str, $position = 'text') {
</del><ins>+  public function EncodeQ($str, $position = 'text') {
</ins><span class="cx">     // There should not be any EOL in the string
</span><span class="cx">     $encoded = preg_replace('/[\r\n]*/', '', $str);
</span><span class="cx"> 
</span><span class="lines">@@ -1733,7 +1859,7 @@
</span><span class="cx">         // Replace every high ascii, control =, ? and _ characters
</span><span class="cx">         //TODO using /e (equivalent to eval()) is probably not a good idea
</span><span class="cx">         $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
</span><del>-              &quot;'='.sprintf('%02X', ord('\\1'))&quot;, $encoded);
</del><ins>+                                &quot;'='.sprintf('%02X', ord(stripslashes('\\1')))&quot;, $encoded);
</ins><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1807,6 +1933,20 @@
</span><span class="cx">     return true;
</span><span class="cx">   }
</span><span class="cx"> 
</span><ins>+  public function AddStringEmbeddedImage($string, $cid, $filename = '', $encoding = 'base64', $type = 'application/octet-stream') {
+    // Append to $attachment array
+    $this-&gt;attachment[] = array(
+      0 =&gt; $string,
+      1 =&gt; $filename,
+      2 =&gt; basename($filename),
+      3 =&gt; $encoding,
+      4 =&gt; $type,
+      5 =&gt; true,  // isStringAttachment
+      6 =&gt; 'inline',
+      7 =&gt; $cid
+    );
+  }
+
</ins><span class="cx">   /**
</span><span class="cx">    * Returns true if an inline attachment is present.
</span><span class="cx">    * @access public
</span><span class="lines">@@ -1821,6 +1961,19 @@
</span><span class="cx">     return false;
</span><span class="cx">   }
</span><span class="cx"> 
</span><ins>+  public function AttachmentExists() {
+    foreach($this-&gt;attachment as $attachment) {
+      if ($attachment[6] == 'attachment') {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  public function AlternativeExists() {
+    return strlen($this-&gt;AltBody)&gt;0;
+  }
+
</ins><span class="cx">   /////////////////////////////////////////////////
</span><span class="cx">   // CLASS METHODS, MESSAGE RESET
</span><span class="cx">   /////////////////////////////////////////////////
</span><span class="lines">@@ -1933,10 +2086,10 @@
</span><span class="cx"> 
</span><span class="cx">   /**
</span><span class="cx">    * Returns the server hostname or 'localhost.localdomain' if unknown.
</span><del>-   * @access private
</del><ins>+   * @access protected
</ins><span class="cx">    * @return string
</span><span class="cx">    */
</span><del>-  private function ServerHostname() {
</del><ins>+  protected function ServerHostname() {
</ins><span class="cx">     if (!empty($this-&gt;Hostname)) {
</span><span class="cx">       $result = $this-&gt;Hostname;
</span><span class="cx">     } elseif (isset($_SERVER['SERVER_NAME'])) {
</span><span class="lines">@@ -1950,10 +2103,10 @@
</span><span class="cx"> 
</span><span class="cx">   /**
</span><span class="cx">    * Returns a message in the appropriate language.
</span><del>-   * @access private
</del><ins>+   * @access protected
</ins><span class="cx">    * @return string
</span><span class="cx">    */
</span><del>-  private function Lang($key) {
</del><ins>+  protected function Lang($key) {
</ins><span class="cx">     if(count($this-&gt;language) &lt; 1) {
</span><span class="cx">       $this-&gt;SetLanguage('en'); // set the default language
</span><span class="cx">     }
</span><span class="lines">@@ -1976,10 +2129,10 @@
</span><span class="cx"> 
</span><span class="cx">   /**
</span><span class="cx">    * Changes every end of line from CR or LF to CRLF.
</span><del>-   * @access private
</del><ins>+   * @access public
</ins><span class="cx">    * @return string
</span><span class="cx">    */
</span><del>-  private function FixEOL($str) {
</del><ins>+  public function FixEOL($str) {
</ins><span class="cx">     $str = str_replace(&quot;\r\n&quot;, &quot;\n&quot;, $str);
</span><span class="cx">     $str = str_replace(&quot;\r&quot;, &quot;\n&quot;, $str);
</span><span class="cx">     $str = str_replace(&quot;\n&quot;, $this-&gt;LE, $str);
</span><span class="lines">@@ -2005,16 +2158,16 @@
</span><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><del>-        if (!preg_match('#^[A-z]+://#',$url)) {
</del><ins>+        if (!preg_match('#^[A-z]+://#', $url)) {
</ins><span class="cx">           $filename = basename($url);
</span><span class="cx">           $directory = dirname($url);
</span><del>-          ($directory == '.')?$directory='':'';
</del><ins>+          ($directory == '.') ? $directory='': '';
</ins><span class="cx">           $cid = 'cid:' . md5($filename);
</span><span class="cx">           $ext = pathinfo($filename, PATHINFO_EXTENSION);
</span><span class="cx">           $mimeType  = self::_mime_types($ext);
</span><del>-          if ( strlen($basedir) &gt; 1 &amp;&amp; substr($basedir,-1) != '/') { $basedir .= '/'; }
-          if ( strlen($directory) &gt; 1 &amp;&amp; substr($directory,-1) != '/') { $directory .= '/'; }
-          if ( $this-&gt;AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
</del><ins>+          if ( strlen($basedir) &gt; 1 &amp;&amp; substr($basedir, -1) != '/') { $basedir .= '/'; }
+          if ( strlen($directory) &gt; 1 &amp;&amp; substr($directory, -1) != '/') { $directory .= '/'; }
+          if ( $this-&gt;AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType) ) {
</ins><span class="cx">             $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);
</span><span class="cx">           }
</span><span class="cx">         }
</span><span class="lines">@@ -2022,7 +2175,7 @@
</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)));
</del><ins>+    $textMsg = trim(strip_tags(preg_replace('/&lt;(head|title|style|script)[^&gt;]*&gt;.*?&lt;\/\\1&gt;/s', '', $message)));
</ins><span class="cx">     if (!empty($textMsg) &amp;&amp; empty($this-&gt;AltBody)) {
</span><span class="cx">       $this-&gt;AltBody = html_entity_decode($textMsg);
</span><span class="cx">     }
</span><span class="lines">@@ -2192,14 +2345,14 @@
</span><span class="cx">    * @param string $key_pass Password for private key
</span><span class="cx">    */
</span><span class="cx">   public function DKIM_QP($txt) {
</span><del>-    $tmp=&quot;&quot;;
-    $line=&quot;&quot;;
-    for ($i=0;$i&lt;strlen($txt);$i++) {
-      $ord=ord($txt[$i]);
</del><ins>+    $tmp = '';
+    $line = '';
+    for ($i = 0; $i &lt; strlen($txt); $i++) {
+      $ord = ord($txt[$i]);
</ins><span class="cx">       if ( ((0x21 &lt;= $ord) &amp;&amp; ($ord &lt;= 0x3A)) || $ord == 0x3C || ((0x3E &lt;= $ord) &amp;&amp; ($ord &lt;= 0x7E)) ) {
</span><del>-        $line.=$txt[$i];
</del><ins>+        $line .= $txt[$i];
</ins><span class="cx">       } else {
</span><del>-        $line.=&quot;=&quot;.sprintf(&quot;%02X&quot;,$ord);
</del><ins>+        $line .= &quot;=&quot;.sprintf(&quot;%02X&quot;, $ord);
</ins><span class="cx">       }
</span><span class="cx">     }
</span><span class="cx">     return $line;
</span><span class="lines">@@ -2213,8 +2366,8 @@
</span><span class="cx">    */
</span><span class="cx">   public function DKIM_Sign($s) {
</span><span class="cx">     $privKeyStr = file_get_contents($this-&gt;DKIM_private);
</span><del>-    if ($this-&gt;DKIM_passphrase!='') {
-      $privKey = openssl_pkey_get_private($privKeyStr,$this-&gt;DKIM_passphrase);
</del><ins>+    if ($this-&gt;DKIM_passphrase != '') {
+      $privKey = openssl_pkey_get_private($privKeyStr, $this-&gt;DKIM_passphrase);
</ins><span class="cx">     } else {
</span><span class="cx">       $privKey = $privKeyStr;
</span><span class="cx">     }
</span><span class="lines">@@ -2230,15 +2383,15 @@
</span><span class="cx">    * @param string $s Header
</span><span class="cx">    */
</span><span class="cx">   public function DKIM_HeaderC($s) {
</span><del>-    $s=preg_replace(&quot;/\r\n\s+/&quot;,&quot; &quot;,$s);
-    $lines=explode(&quot;\r\n&quot;,$s);
-    foreach ($lines as $key=&gt;$line) {
-      list($heading,$value)=explode(&quot;:&quot;,$line,2);
-      $heading=strtolower($heading);
-      $value=preg_replace(&quot;/\s+/&quot;,&quot; &quot;,$value) ; // Compress useless spaces
-      $lines[$key]=$heading.&quot;:&quot;.trim($value) ; // Don't forget to remove WSP around the value
</del><ins>+    $s = preg_replace(&quot;/\r\n\s+/&quot;, &quot; &quot;, $s);
+    $lines = explode(&quot;\r\n&quot;, $s);
+    foreach ($lines as $key =&gt; $line) {
+      list($heading, $value) = explode(&quot;:&quot;, $line, 2);
+      $heading = strtolower($heading);
+      $value = preg_replace(&quot;/\s+/&quot;, &quot; &quot;, $value) ; // Compress useless spaces
+      $lines[$key] = $heading.&quot;:&quot;.trim($value) ; // Don't forget to remove WSP around the value
</ins><span class="cx">     }
</span><del>-    $s=implode(&quot;\r\n&quot;,$lines);
</del><ins>+    $s = implode(&quot;\r\n&quot;, $lines);
</ins><span class="cx">     return $s;
</span><span class="cx">   }
</span><span class="cx"> 
</span><span class="lines">@@ -2251,11 +2404,11 @@
</span><span class="cx">   public function DKIM_BodyC($body) {
</span><span class="cx">     if ($body == '') return &quot;\r\n&quot;;
</span><span class="cx">     // stabilize line endings
</span><del>-    $body=str_replace(&quot;\r\n&quot;,&quot;\n&quot;,$body);
-    $body=str_replace(&quot;\n&quot;,&quot;\r\n&quot;,$body);
</del><ins>+    $body = str_replace(&quot;\r\n&quot;, &quot;\n&quot;, $body);
+    $body = str_replace(&quot;\n&quot;, &quot;\r\n&quot;, $body);
</ins><span class="cx">     // END stabilize line endings
</span><del>-    while (substr($body,strlen($body)-4,4) == &quot;\r\n\r\n&quot;) {
-      $body=substr($body,0,strlen($body)-2);
</del><ins>+    while (substr($body, strlen($body) - 4, 4) == &quot;\r\n\r\n&quot;) {
+      $body = substr($body, 0, strlen($body) - 2);
</ins><span class="cx">     }
</span><span class="cx">     return $body;
</span><span class="cx">   }
</span><span class="lines">@@ -2268,23 +2421,23 @@
</span><span class="cx">    * @param string $subject Subject
</span><span class="cx">    * @param string $body Body
</span><span class="cx">    */
</span><del>-  public function DKIM_Add($headers_line,$subject,$body) {
</del><ins>+  public function DKIM_Add($headers_line, $subject, $body) {
</ins><span class="cx">     $DKIMsignatureType    = 'rsa-sha1'; // Signature &amp; hash algorithms
</span><span class="cx">     $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
</span><span class="cx">     $DKIMquery            = 'dns/txt'; // Query method
</span><span class="cx">     $DKIMtime             = time() ; // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
</span><span class="cx">     $subject_header       = &quot;Subject: $subject&quot;;
</span><del>-    $headers              = explode(&quot;\r\n&quot;,$headers_line);
</del><ins>+    $headers              = explode($this-&gt;LE, $headers_line);
</ins><span class="cx">     foreach($headers as $header) {
</span><del>-      if (strpos($header,'From:') === 0) {
-        $from_header=$header;
-      } elseif (strpos($header,'To:') === 0) {
-        $to_header=$header;
</del><ins>+      if (strpos($header, 'From:') === 0) {
+        $from_header = $header;
+      } elseif (strpos($header, 'To:') === 0) {
+        $to_header = $header;
</ins><span class="cx">       }
</span><span class="cx">     }
</span><del>-    $from     = str_replace('|','=7C',$this-&gt;DKIM_QP($from_header));
-    $to       = str_replace('|','=7C',$this-&gt;DKIM_QP($to_header));
-    $subject  = str_replace('|','=7C',$this-&gt;DKIM_QP($subject_header)) ; // Copied header fields (dkim-quoted-printable
</del><ins>+    $from     = str_replace('|', '=7C', $this-&gt;DKIM_QP($from_header));
+    $to       = str_replace('|', '=7C', $this-&gt;DKIM_QP($to_header));
+    $subject  = str_replace('|', '=7C', $this-&gt;DKIM_QP($subject_header)) ; // Copied header fields (dkim-quoted-printable
</ins><span class="cx">     $body     = $this-&gt;DKIM_BodyC($body);
</span><span class="cx">     $DKIMlen  = strlen($body) ; // Length of body
</span><span class="cx">     $DKIMb64  = base64_encode(pack(&quot;H*&quot;, sha1($body))) ; // Base64 of packed binary SHA-1 hash of body
</span><span class="lines">@@ -2303,10 +2456,10 @@
</span><span class="cx">     return &quot;X-PHPMAILER-DKIM: phpmailer.worxware.com\r\n&quot;.$dkimhdrs.$signed.&quot;\r\n&quot;;
</span><span class="cx">   }
</span><span class="cx"> 
</span><del>-  protected function doCallback($isSent,$to,$cc,$bcc,$subject,$body) {
</del><ins>+  protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body) {
</ins><span class="cx">     if (!empty($this-&gt;action_function) &amp;&amp; function_exists($this-&gt;action_function)) {
</span><del>-      $params = array($isSent,$to,$cc,$bcc,$subject,$body);
-      call_user_func_array($this-&gt;action_function,$params);
</del><ins>+      $params = array($isSent, $to, $cc, $bcc, $subject, $body);
+      call_user_func_array($this-&gt;action_function, $params);
</ins><span class="cx">     }
</span><span class="cx">   }
</span><span class="cx"> }
</span><span class="lines">@@ -2317,4 +2470,4 @@
</span><span class="cx">     return $errorMsg;
</span><span class="cx">   }
</span><span class="cx"> }
</span><del>-?&gt;
</del><span class="cx">\ No newline at end of file
</span><ins>+?&gt;
</ins></span></pre></div>
<a id="trunkwpincludesclasssmtpphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-smtp.php (19631 => 19632)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-smtp.php        2011-12-25 17:27:39 UTC (rev 19631)
+++ trunk/wp-includes/class-smtp.php        2011-12-28 12:59:13 UTC (rev 19632)
</span><span class="lines">@@ -2,15 +2,15 @@
</span><span class="cx"> /*~ class.smtp.php
</span><span class="cx"> .---------------------------------------------------------------------------.
</span><span class="cx"> |  Software: PHPMailer - PHP email class                                    |
</span><del>-|   Version: 5.1                                                            |
-|   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
-|      Info: http://phpmailer.sourceforge.net                               |
-|   Support: http://sourceforge.net/projects/phpmailer/                     |
</del><ins>+|   Version: 5.2                                                            |
+|      Site: https://code.google.com/a/apache-extras.org/p/phpmailer/       |
</ins><span class="cx"> | ------------------------------------------------------------------------- |
</span><del>-|     Admin: Andy Prevost (project admininistrator)                         |
</del><ins>+|     Admin: Jim Jagielski (project admininistrator)                        |
</ins><span class="cx"> |   Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
</span><span class="cx"> |          : Marcus Bointon (coolbru) coolbru@users.sourceforge.net         |
</span><ins>+|          : Jim Jagielski (jimjag) jimjag@gmail.com                        |
</ins><span class="cx"> |   Founder: Brent R. Matzelle (original founder)                           |
</span><ins>+| Copyright (c) 2010-2011, 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">@@ -19,11 +19,6 @@
</span><span class="cx"> | This program is distributed in the hope that it will be useful - WITHOUT  |
</span><span class="cx"> | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     |
</span><span class="cx"> | FITNESS FOR A PARTICULAR PURPOSE.                                         |
</span><del>-| ------------------------------------------------------------------------- |
-| We offer a number of paid services (www.codeworxtech.com):                |
-| - Web Hosting on highly optimized fast and secure servers                 |
-| - Technology Consulting                                                   |
-| - Oursourcing (highly qualified programmers and graphic designers)        |
</del><span class="cx"> '---------------------------------------------------------------------------'
</span><span class="cx"> */
</span><span class="cx"> 
</span><span class="lines">@@ -34,8 +29,10 @@
</span><span class="cx">  * @author Andy Prevost
</span><span class="cx">  * @author Marcus Bointon
</span><span class="cx">  * @copyright 2004 - 2008 Andy Prevost
</span><ins>+ * @author Jim Jagielski
+ * @copyright 2010 - 2011 Jim Jagielski
</ins><span class="cx">  * @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
</span><del>- * @version $Id: class.smtp.php 444 2009-05-05 11:22:26Z coolbru $
</del><ins>+ * @version $Id: class.smtp.php 450 2010-06-23 16:46:33Z coolbru $
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -71,6 +68,12 @@
</span><span class="cx">    */
</span><span class="cx">   public $do_verp = false;
</span><span class="cx"> 
</span><ins>+  /**
+   * Sets the SMTP PHPMailer Version number
+   * @var string
+   */
+  public $Version         = '5.2';
+
</ins><span class="cx">   /////////////////////////////////////////////////
</span><span class="cx">   // PROPERTIES, PRIVATE AND PROTECTED
</span><span class="cx">   /////////////////////////////////////////////////
</span><span class="lines">@@ -811,4 +814,4 @@
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-?&gt;
</del><span class="cx">\ No newline at end of file
</span><ins>+?&gt;
</ins></span></pre>
</div>
</div>

</body>
</html>