Changeset 36083 for trunk/src/wp-includes/class-smtp.php
- Timestamp:
- 12/24/2015 01:58:33 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-smtp.php
r33124 r36083 29 29 /** 30 30 * The PHPMailer SMTP version number. 31 * @ typestring32 */ 33 const VERSION = '5.2.1 0';31 * @var string 32 */ 33 const VERSION = '5.2.14'; 34 34 35 35 /** 36 36 * SMTP line break constant. 37 * @ typestring37 * @var string 38 38 */ 39 39 const CRLF = "\r\n"; … … 41 41 /** 42 42 * The SMTP port to use if one is not specified. 43 * @ typeinteger43 * @var integer 44 44 */ 45 45 const DEFAULT_SMTP_PORT = 25; … … 47 47 /** 48 48 * The maximum line length allowed by RFC 2822 section 2.1.1 49 * @ typeinteger49 * @var integer 50 50 */ 51 51 const MAX_LINE_LENGTH = 998; … … 78 78 /** 79 79 * The PHPMailer SMTP Version number. 80 * @ typestring80 * @var string 81 81 * @deprecated Use the `VERSION` constant instead 82 82 * @see SMTP::VERSION 83 83 */ 84 public $Version = '5.2.1 0';84 public $Version = '5.2.14'; 85 85 86 86 /** 87 87 * SMTP server port number. 88 * @ typeinteger88 * @var integer 89 89 * @deprecated This is only ever used as a default value, so use the `DEFAULT_SMTP_PORT` constant instead 90 90 * @see SMTP::DEFAULT_SMTP_PORT … … 94 94 /** 95 95 * SMTP reply line ending. 96 * @ typestring96 * @var string 97 97 * @deprecated Use the `CRLF` constant instead 98 98 * @see SMTP::CRLF … … 108 108 * * self::DEBUG_CONNECTION (`3`) As DEBUG_SERVER plus connection status 109 109 * * self::DEBUG_LOWLEVEL (`4`) Low-level data output, all messages 110 * @ typeinteger110 * @var integer 111 111 */ 112 112 public $do_debug = self::DEBUG_OFF; … … 123 123 * $smtp->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";}; 124 124 * </code> 125 * @ typestring|callable125 * @var string|callable 126 126 */ 127 127 public $Debugoutput = 'echo'; … … 131 131 * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path 132 132 * @link http://www.postfix.org/VERP_README.html Info on VERP 133 * @ typeboolean133 * @var boolean 134 134 */ 135 135 public $do_verp = false; … … 140 140 * This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure. 141 141 * @link http://tools.ietf.org/html/rfc2821#section-4.5.3.2 142 * @ typeinteger142 * @var integer 143 143 */ 144 144 public $Timeout = 300; … … 147 147 * How long to wait for commands to complete, in seconds. 148 148 * Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2 149 * @ typeinteger149 * @var integer 150 150 */ 151 151 public $Timelimit = 300; … … 153 153 /** 154 154 * The socket for the server connection. 155 * @ typeresource155 * @var resource 156 156 */ 157 157 protected $smtp_conn; … … 159 159 /** 160 160 * Error information, if any, for the last SMTP command. 161 * @ typearray161 * @var array 162 162 */ 163 163 protected $error = array( … … 171 171 * The reply the server sent to us for HELO. 172 172 * If null, no HELO string has yet been received. 173 * @ typestring|null173 * @var string|null 174 174 */ 175 175 protected $helo_rply = null; … … 182 182 * Other values can be boolean TRUE or an array containing extension options. 183 183 * If null, no HELO/EHLO string has yet been received. 184 * @ typearray|null184 * @var array|null 185 185 */ 186 186 protected $server_caps = null; … … 188 188 /** 189 189 * The most recent reply received from the server. 190 * @ typestring190 * @var string 191 191 */ 192 192 protected $last_reply = ''; … … 352 352 * Must be run after hello(). 353 353 * @see hello() 354 * @param string $username 355 * @param string $password 356 * @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5)357 * @param string $realm 354 * @param string $username The user name 355 * @param string $password The password 356 * @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5, XOAUTH2) 357 * @param string $realm The auth realm for NTLM 358 358 * @param string $workstation The auth workstation for NTLM 359 * @ access public360 * @return bool ean True if successfully authenticated.359 * @param null|OAuth $OAuth An optional OAuth instance (@see PHPMailerOAuth) 360 * @return bool True if successfully authenticated.* @access public 361 361 */ 362 362 public function authenticate( … … 365 365 $authtype = null, 366 366 $realm = '', 367 $workstation = '' 367 $workstation = '', 368 $OAuth = null 368 369 ) { 369 370 if (!$this->server_caps) { … … 674 675 $this->server_caps = array(); 675 676 $lines = explode("\n", $this->last_reply); 677 676 678 foreach ($lines as $n => $s) { 679 //First 4 chars contain response code followed by - or space 677 680 $s = trim(substr($s, 4)); 678 if ( !$s) {681 if (empty($s)) { 679 682 continue; 680 683 } … … 686 689 } else { 687 690 $name = array_shift($fields); 688 if ($name == 'SIZE') { 689 $fields = ($fields) ? $fields[0] : 0; 691 switch ($name) { 692 case 'SIZE': 693 $fields = ($fields ? $fields[0] : 0); 694 break; 695 case 'AUTH': 696 if (!is_array($fields)) { 697 $fields = array(); 698 } 699 break; 700 default: 701 $fields = true; 690 702 } 691 703 } 692 $this->server_caps[$name] = ($fields ? $fields : true);704 $this->server_caps[$name] = $fields; 693 705 } 694 706 } … … 740 752 * Returns true if the recipient was accepted false if it was rejected. 741 753 * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF> 742 * @param string $ toaddrThe address the message is being sent to743 * @access public 744 * @return boolean 745 */ 746 public function recipient($ toaddr)754 * @param string $address The address the message is being sent to 755 * @access public 756 * @return boolean 757 */ 758 public function recipient($address) 747 759 { 748 760 return $this->sendCommand( 749 761 'RCPT TO', 750 'RCPT TO:<' . $ toaddr. '>',762 'RCPT TO:<' . $address . '>', 751 763 array(250, 251) 752 764 ); … … 767 779 /** 768 780 * Send a command to an SMTP server and check its return code. 769 * @param string $command 781 * @param string $command The command name - not sent to the server 770 782 * @param string $commandstring The actual command to send 771 * @param integer|array $expect 783 * @param integer|array $expect One or more expected integer success codes 772 784 * @access protected 773 785 * @return boolean True on success. … … 777 789 if (!$this->connected()) { 778 790 $this->setError("Called $command without being connected"); 791 return false; 792 } 793 //Reject line breaks in all commands 794 if (strpos($commandstring, "\n") !== false or strpos($commandstring, "\r") !== false) { 795 $this->setError("Command '$command' contained line breaks"); 779 796 return false; 780 797 } … … 982 999 while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) { 983 1000 $str = @fgets($this->smtp_conn, 515); 984 $this->edebug("SMTP -> get_lines(): \$data was \"$data\"", self::DEBUG_LOWLEVEL);985 $this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL);1001 $this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL); 1002 $this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL); 986 1003 $data .= $str; 987 $this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL);988 1004 // If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen 989 1005 if ((isset($str[3]) and $str[3] == ' ')) {
Note: See TracChangeset
for help on using the changeset viewer.