Update phpMailer to 2.0.2. Props mattyrob. fixes #7474

git-svn-id: http://svn.automattic.com/wordpress/trunk@8762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-08-28 20:26:36 +00:00
parent 298db96458
commit d0ac3df8f7
3 changed files with 3183 additions and 2987 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,38 @@
<?php <?php
/** /*~ class.smtp.php
* SMTP - PHP SMTP class .---------------------------------------------------------------------------.
* | Software: PHPMailer - PHP email class |
* Define an SMTP class that can be used to connect and communicate with any | Version: 2.0.2 |
* SMTP server. It implements all the SMTP functions defined in RFC821 except | Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
* TURN. | Info: http://phpmailer.sourceforge.net |
* | Support: http://sourceforge.net/projects/phpmailer/ |
* @version 1.02 | ------------------------------------------------------------------------- |
* @author Chris Ryan | Author: Andy Prevost (project admininistrator) |
* @license LGPL | Author: Brent R. Matzelle (original founder) |
* @package PHPMailer | Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. |
*/ | Copyright (c) 2001-2003, Brent R. Matzelle |
| ------------------------------------------------------------------------- |
| License: Distributed under the Lesser General Public License (LGPL) |
| http://www.gnu.org/copyleft/lesser.html |
| This program is distributed in the hope that it will be useful - WITHOUT |
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. |
| ------------------------------------------------------------------------- |
| 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) |
'---------------------------------------------------------------------------'
/** /**
* SMTP is rfc 821 compliant and implements all the rfc 821 SMTP * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
* commands except TURN which will always return a not implemented * commands except TURN which will always return a not implemented
* error. SMTP also provides some utility methods for sending mail * error. SMTP also provides some utility methods for sending mail
* to an SMTP server. * to an SMTP server.
*
* @package PHPMailer * @package PHPMailer
* @author Chris Ryan * @author Chris Ryan
*/ */
class SMTP class SMTP
{ {
/** /**
@ -41,6 +53,12 @@ class SMTP
*/ */
var $do_debug; # the level of debug to perform var $do_debug; # the level of debug to perform
/**
* Sets VERP use on/off (default is off)
* @var bool
*/
var $do_verp = false;
/**#@+ /**#@+
* @access private * @access private
*/ */
@ -88,8 +106,7 @@ class SMTP
# ok we are connected! what should we do? # ok we are connected! what should we do?
# for now we will just give an error saying we # for now we will just give an error saying we
# are already connected # are already connected
$this->error = $this->error = array("error" => "Already connected to a server");
array("error" => "Already connected to a server");
return false; return false;
} }
@ -209,7 +226,7 @@ class SMTP
$sock_status = socket_get_status($this->smtp_conn); $sock_status = socket_get_status($this->smtp_conn);
if($sock_status["eof"]) { if($sock_status["eof"]) {
# hmm this is an odd situation... the socket is # hmm this is an odd situation... the socket is
# valid but we aren't connected anymore # valid but we are not connected anymore
if($this->do_debug >= 1) { if($this->do_debug >= 1) {
echo "SMTP -> NOTICE:" . $this->CRLF . echo "SMTP -> NOTICE:" . $this->CRLF .
"EOF caught while checking if connected"; "EOF caught while checking if connected";
@ -239,7 +256,6 @@ class SMTP
} }
} }
/*************************************************************** /***************************************************************
* SMTP COMMANDS * * SMTP COMMANDS *
*************************************************************/ *************************************************************/
@ -249,7 +265,7 @@ class SMTP
* finializing the mail transaction. $msg_data is the message * finializing the mail transaction. $msg_data is the message
* that is to be send with the headers. Each header needs to be * that is to be send with the headers. Each header needs to be
* on a single line followed by a <CRLF> with the message headers * on a single line followed by a <CRLF> with the message headers
* and the message body being separated by and additional <CRLF>. * and the message body being seperated by and additional <CRLF>.
* *
* Implements rfc 821: DATA <CRLF> * Implements rfc 821: DATA <CRLF>
* *
@ -310,7 +326,7 @@ class SMTP
# we need to find a good way to determine is headers are # we need to find a good way to determine is headers are
# in the msg_data or if it is a straight msg body # in the msg_data or if it is a straight msg body
# currently I'm assuming rfc 822 definitions of msg headers # currently I am assuming rfc 822 definitions of msg headers
# and if the first field of the first line (':' sperated) # and if the first field of the first line (':' sperated)
# does not contain a space then it _should_ be a header # does not contain a space then it _should_ be a header
# and we can process all lines before a blank "" line as # and we can process all lines before a blank "" line as
@ -462,7 +478,7 @@ class SMTP
return false; return false;
} }
# if a hostname for the HELO wasn't specified determine # if a hostname for the HELO was not specified determine
# a suitable one to send # a suitable one to send
if(empty($host)) { if(empty($host)) {
# we need to determine some sort of appopiate default # we need to determine some sort of appopiate default
@ -588,7 +604,8 @@ class SMTP
return false; return false;
} }
fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $this->CRLF); $useVerp = ($this->do_verp ? "XVERP" : "");
fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
$rply = $this->get_lines(); $rply = $this->get_lines();
$code = substr($rply,0,3); $code = substr($rply,0,3);
@ -1021,7 +1038,7 @@ class SMTP
*/ */
function get_lines() { function get_lines() {
$data = ""; $data = "";
while($str = fgets($this->smtp_conn,515)) { while($str = @fgets($this->smtp_conn,515)) {
if($this->do_debug >= 4) { if($this->do_debug >= 4) {
echo "SMTP -> get_lines(): \$data was \"$data\"" . echo "SMTP -> get_lines(): \$data was \"$data\"" .
$this->CRLF; $this->CRLF;