Changeset 19849
- Timestamp:
- 02/07/2012 04:13:51 PM (13 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-phpmailer.php
r19642 r19849 3 3 .---------------------------------------------------------------------------. 4 4 | Software: PHPMailer - PHP email class | 5 | Version: 5.2 5 | Version: 5.2.1 | 6 6 | Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ | 7 7 | ------------------------------------------------------------------------- | … … 11 11 | : Jim Jagielski (jimjag) jimjag@gmail.com | 12 12 | Founder: Brent R. Matzelle (original founder) | 13 | Copyright (c) 2010-201 1, Jim Jagielski. All Rights Reserved.|13 | Copyright (c) 2010-2012, Jim Jagielski. All Rights Reserved. | 14 14 | Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. | 15 15 | Copyright (c) 2001-2003, Brent R. Matzelle | … … 30 30 * @author Marcus Bointon 31 31 * @author Jim Jagielski 32 * @copyright 2010 - 201 1Jim Jagielski32 * @copyright 2010 - 2012 Jim Jagielski 33 33 * @copyright 2004 - 2009 Andy Prevost 34 34 * @version $Id: class.phpmailer.php 450 2010-06-23 16:46:33Z coolbru $ … … 129 129 */ 130 130 protected $MIMEHeader = ''; 131 132 /** 133 * Stores the complete sent MIME message (Body and Headers) 134 * @var string 135 * @access protected 136 */ 137 protected $SentMIMEMessage = ''; 131 138 132 139 /** … … 318 325 * @var string 319 326 */ 320 public $Version = '5.2 ';327 public $Version = '5.2.1'; 321 328 322 329 /** … … 461 468 */ 462 469 public function AddReplyTo($address, $name = '') { 463 return $this->AddAnAddress('Reply To', $address, $name);470 return $this->AddAnAddress('Reply-To', $address, $name); 464 471 } 465 472 … … 474 481 */ 475 482 protected function AddAnAddress($kind, $address, $name = '') { 476 if (!preg_match('/^(to|cc|bcc|Reply To)$/', $kind)) {483 if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) { 477 484 $this->SetError($this->Lang('Invalid recipient array').': '.$kind); 478 485 if ($this->exceptions) { 479 486 throw new phpmailerException('Invalid recipient array: ' . $kind); 480 487 } 481 echo $this->Lang('Invalid recipient array').': '.$kind; 488 if ($this->SMTPDebug) { 489 echo $this->Lang('Invalid recipient array').': '.$kind; 490 } 482 491 return false; 483 492 } … … 489 498 throw new phpmailerException($this->Lang('invalid_address').': '.$address); 490 499 } 491 echo $this->Lang('invalid_address').': '.$address; 500 if ($this->SMTPDebug) { 501 echo $this->Lang('invalid_address').': '.$address; 502 } 492 503 return false; 493 504 } 494 if ($kind != 'Reply To') {505 if ($kind != 'Reply-To') { 495 506 if (!isset($this->all_recipients[strtolower($address)])) { 496 507 array_push($this->$kind, array($address, $name)); … … 521 532 throw new phpmailerException($this->Lang('invalid_address').': '.$address); 522 533 } 523 echo $this->Lang('invalid_address').': '.$address; 534 if ($this->SMTPDebug) { 535 echo $this->Lang('invalid_address').': '.$address; 536 } 524 537 return false; 525 538 } … … 528 541 if ($auto) { 529 542 if (empty($this->ReplyTo)) { 530 $this->AddAnAddress('Reply To', $address, $name);543 $this->AddAnAddress('Reply-To', $address, $name); 531 544 } 532 545 if (empty($this->Sender)) { … … 575 588 return $this->PostSend(); 576 589 } catch (phpmailerException $e) { 590 $this->SentMIMEMessage = ''; 577 591 $this->SetError($e->getMessage()); 578 592 if ($this->exceptions) { … … 585 599 protected function PreSend() { 586 600 try { 601 $mailHeader = ""; 587 602 if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) { 588 603 throw new phpmailerException($this->Lang('provide_address'), self::STOP_CRITICAL); … … 604 619 $this->MIMEBody = $this->CreateBody(); 605 620 621 // To capture the complete message when using mail(), create 622 // an extra header list which CreateHeader() doesn't fold in 623 if ($this->Mailer == 'mail') { 624 if (count($this->to) > 0) { 625 $mailHeader .= $this->AddrAppend("To", $this->to); 626 } else { 627 $mailHeader .= $this->HeaderLine("To", "undisclosed-recipients:;"); 628 } 629 $mailHeader .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader(trim($this->Subject)))); 630 // if(count($this->cc) > 0) { 631 // $mailHeader .= $this->AddrAppend("Cc", $this->cc); 632 // } 633 } 606 634 607 635 // digitally sign with DKIM if enabled … … 611 639 } 612 640 641 $this->SentMIMEMessage = sprintf("%s%s\r\n\r\n%s",$this->MIMEHeader,$mailHeader,$this->MIMEBody); 613 642 return true; 643 614 644 } catch (phpmailerException $e) { 615 645 $this->SetError($e->getMessage()); … … 629 659 case 'smtp': 630 660 return $this->SmtpSend($this->MIMEHeader, $this->MIMEBody); 661 case 'mail': 662 return $this->MailSend($this->MIMEHeader, $this->MIMEBody); 631 663 default: 632 664 return $this->MailSend($this->MIMEHeader, $this->MIMEBody); … … 638 670 throw $e; 639 671 } 640 echo $e->getMessage()."\n"; 672 if ($this->SMTPDebug) { 673 echo $e->getMessage()."\n"; 674 } 641 675 return false; 642 676 } … … 704 738 705 739 if (empty($this->Sender)) { 706 $params = "-oi -f %s";740 $params = "-oi "; 707 741 } else { 708 742 $params = sprintf("-oi -f %s", $this->Sender); … … 733 767 } 734 768 } else { 735 $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header );769 $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); 736 770 // implement call back function if it exists 737 771 $isSent = ($rt == 1) ? 1 : 0; … … 881 915 } catch (phpmailerException $e) { 882 916 $this->smtp->Reset(); 883 throw $e; 917 if ($this->exceptions) { 918 throw $e; 919 } 884 920 } 885 921 return true; … … 1160 1196 } 1161 1197 } 1162 1198 } 1163 1199 1164 1200 $from = array(); … … 1178 1214 1179 1215 if(count($this->ReplyTo) > 0) { 1180 $result .= $this->AddrAppend('Reply- to', $this->ReplyTo);1216 $result .= $this->AddrAppend('Reply-To', $this->ReplyTo); 1181 1217 } 1182 1218 … … 1250 1286 return $result; 1251 1287 } 1288 1289 /** 1290 * Returns the MIME message (headers and body). Only really valid post PreSend(). 1291 * @access public 1292 * @return string 1293 */ 1294 public function GetSentMIMEMessage() { 1295 return $this->SentMIMEMessage; 1296 } 1297 1252 1298 1253 1299 /** … … 1364 1410 if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), NULL)) { 1365 1411 @unlink($file); 1412 $body = file_get_contents($signed); 1366 1413 @unlink($signed); 1367 $body = file_get_contents($signed);1368 1414 } else { 1369 1415 @unlink($file); … … 1488 1534 throw $e; 1489 1535 } 1490 echo $e->getMessage()."\n"; 1536 if ($this->SMTPDebug) { 1537 echo $e->getMessage()."\n"; 1538 } 1491 1539 if ( $e->getCode() == self::STOP_CRITICAL ) { 1492 1540 return false; … … 1591 1639 } 1592 1640 } 1593 if (version_compare(PHP_VERSION, '5.3.0', '<')) { 1594 $magic_quotes = get_magic_quotes_runtime(); 1595 set_magic_quotes_runtime(0); 1596 } 1641 $magic_quotes = get_magic_quotes_runtime(); 1642 if ($magic_quotes) { 1643 if (version_compare(PHP_VERSION, '5.3.0', '<')) { 1644 set_magic_quotes_runtime(0); 1645 } else { 1646 ini_set('magic_quotes_runtime', 0); 1647 } 1648 } 1597 1649 $file_buffer = file_get_contents($path); 1598 1650 $file_buffer = $this->EncodeString($file_buffer, $encoding); 1599 if (version_compare(PHP_VERSION, '5.3.0', '<')) { 1600 set_magic_quotes_runtime($magic_quotes); 1601 } 1651 if ($magic_quotes) { 1652 if (version_compare(PHP_VERSION, '5.3.0', '<')) { 1653 set_magic_quotes_runtime($magic_quotes); 1654 } else { 1655 ini_set('magic_quotes_runtime', $magic_quotes); 1656 } 1657 } 1602 1658 return $file_buffer; 1603 1659 } catch (Exception $e) { … … 2155 2211 */ 2156 2212 public function MsgHTML($message, $basedir = '') { 2157 preg_match_all("/(src|background)= \"(.*)\"/Ui", $message, $images);2213 preg_match_all("/(src|background)=[\"'](.*)[\"']/Ui", $message, $images); 2158 2214 if(isset($images[2])) { 2159 2215 foreach($images[2] as $i => $url) { … … 2169 2225 if ( strlen($directory) > 1 && substr($directory, -1) != '/') { $directory .= '/'; } 2170 2226 if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType) ) { 2171 $message = preg_replace("/".$images[1][$i]."= \"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);2227 $message = preg_replace("/".$images[1][$i]."=[\"']".preg_quote($url, '/')."[\"']/Ui", $images[1][$i]."=\"".$cid."\"", $message); 2172 2228 } 2173 2229 } … … 2176 2232 $this->IsHTML(true); 2177 2233 $this->Body = $message; 2178 $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s', '', $message))); 2179 if (!empty($textMsg) && empty($this->AltBody)) { 2180 $this->AltBody = html_entity_decode($textMsg); 2181 } 2234 if (empty($this->AltBody)) { 2235 $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s', '', $message))); 2236 if (!empty($textMsg)) { 2237 $this->AltBody = html_entity_decode($textMsg, ENT_QUOTES, $this->CharSet); 2238 } 2239 } 2182 2240 if (empty($this->AltBody)) { 2183 2241 $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n"; 2184 2242 } 2243 return $message; 2185 2244 } 2186 2245 -
trunk/wp-includes/class-smtp.php
r19632 r19849 3 3 .---------------------------------------------------------------------------. 4 4 | Software: PHPMailer - PHP email class | 5 | Version: 5.2 5 | Version: 5.2.1 | 6 6 | Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ | 7 7 | ------------------------------------------------------------------------- | … … 11 11 | : Jim Jagielski (jimjag) jimjag@gmail.com | 12 12 | Founder: Brent R. Matzelle (original founder) | 13 | Copyright (c) 2010-201 1, Jim Jagielski. All Rights Reserved.|13 | Copyright (c) 2010-2012, Jim Jagielski. All Rights Reserved. | 14 14 | Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. | 15 15 | Copyright (c) 2001-2003, Brent R. Matzelle | … … 31 31 * @copyright 2004 - 2008 Andy Prevost 32 32 * @author Jim Jagielski 33 * @copyright 2010 - 201 1Jim Jagielski33 * @copyright 2010 - 2012 Jim Jagielski 34 34 * @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL) 35 35 * @version $Id: class.smtp.php 450 2010-06-23 16:46:33Z coolbru $ … … 73 73 * @var string 74 74 */ 75 public $Version = '5.2 ';75 public $Version = '5.2.1'; 76 76 77 77 ///////////////////////////////////////////////// … … 798 798 private function get_lines() { 799 799 $data = ""; 800 while($str = @fgets($this->smtp_conn,515)) { 800 while(!feof($this->smtp_conn)) { 801 $str = @fgets($this->smtp_conn,515); 801 802 if($this->do_debug >= 4) { 802 803 echo "SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF . '<br />';
Note: See TracChangeset
for help on using the changeset viewer.