Merge branch 'testing' into 0.9.x

This commit is contained in:
Brion Vibber 2010-05-03 12:25:29 -07:00
commit f514f7b722
8 changed files with 151 additions and 329 deletions

82
extlib/Mail.php Executable file → Normal file
View File

@ -1,47 +1,22 @@
<?php <?php
/** //
* PEAR's Mail:: interface. // +----------------------------------------------------------------------+
* // | PHP Version 4 |
* PHP versions 4 and 5 // +----------------------------------------------------------------------+
* // | Copyright (c) 1997-2003 The PHP Group |
* LICENSE: // +----------------------------------------------------------------------+
* // | This source file is subject to version 2.02 of the PHP license, |
* Copyright (c) 2002-2007, Richard Heyes // | that is bundled with this package in the file LICENSE, and is |
* All rights reserved. // | available at through the world-wide-web at |
* // | http://www.php.net/license/2_02.txt. |
* Redistribution and use in source and binary forms, with or without // | If you did not receive a copy of the PHP license and are unable to |
* modification, are permitted provided that the following conditions // | obtain it through the world-wide-web, please send a note to |
* are met: // | license@php.net so we can mail you a copy immediately. |
* // +----------------------------------------------------------------------+
* o Redistributions of source code must retain the above copyright // | Author: Chuck Hagenbuch <chuck@horde.org> |
* notice, this list of conditions and the following disclaimer. // +----------------------------------------------------------------------+
* o Redistributions in binary form must reproduce the above copyright //
* notice, this list of conditions and the following disclaimer in the // $Id: Mail.php,v 1.17 2006/09/15 03:41:18 jon Exp $
* documentation and/or other materials provided with the distribution.
* o The names of the authors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @category Mail
* @package Mail
* @author Chuck Hagenbuch <chuck@horde.org>
* @copyright 1997-2010 Chuck Hagenbuch
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version CVS: $Id: Mail.php 294747 2010-02-08 08:18:33Z clockwerx $
* @link http://pear.php.net/package/Mail/
*/
require_once 'PEAR.php'; require_once 'PEAR.php';
@ -51,7 +26,7 @@ require_once 'PEAR.php';
* useful in multiple mailer backends. * useful in multiple mailer backends.
* *
* @access public * @access public
* @version $Revision: 294747 $ * @version $Revision: 1.17 $
* @package Mail * @package Mail
*/ */
class Mail class Mail
@ -107,20 +82,12 @@ class Mail
* @return mixed Returns true on success, or a PEAR_Error * @return mixed Returns true on success, or a PEAR_Error
* containing a descriptive error message on * containing a descriptive error message on
* failure. * failure.
*
* @access public * @access public
* @deprecated use Mail_mail::send instead * @deprecated use Mail_mail::send instead
*/ */
function send($recipients, $headers, $body) function send($recipients, $headers, $body)
{ {
if (!is_array($headers)) { $this->_sanitizeHeaders($headers);
return PEAR::raiseError('$headers must be an array');
}
$result = $this->_sanitizeHeaders($headers);
if (is_a($result, 'PEAR_Error')) {
return $result;
}
// if we're passed an array of recipients, implode it. // if we're passed an array of recipients, implode it.
if (is_array($recipients)) { if (is_array($recipients)) {
@ -136,9 +103,10 @@ class Mail
} }
// flatten the headers out. // flatten the headers out.
list(, $text_headers) = Mail::prepareHeaders($headers); list(,$text_headers) = Mail::prepareHeaders($headers);
return mail($recipients, $subject, $body, $text_headers); return mail($recipients, $subject, $body, $text_headers);
} }
/** /**
@ -183,9 +151,9 @@ class Mail
foreach ($headers as $key => $value) { foreach ($headers as $key => $value) {
if (strcasecmp($key, 'From') === 0) { if (strcasecmp($key, 'From') === 0) {
include_once 'Mail/RFC822.php'; include_once 'Mail/RFC822.php';
$parser = new Mail_RFC822(); $parser = &new Mail_RFC822();
$addresses = $parser->parseAddressList($value, 'localhost', false); $addresses = $parser->parseAddressList($value, 'localhost', false);
if (is_a($addresses, 'PEAR_Error')) { if (PEAR::isError($addresses)) {
return $addresses; return $addresses;
} }
@ -253,7 +221,7 @@ class Mail
$addresses = Mail_RFC822::parseAddressList($recipients, 'localhost', false); $addresses = Mail_RFC822::parseAddressList($recipients, 'localhost', false);
// If parseAddressList() returned a PEAR_Error object, just return it. // If parseAddressList() returned a PEAR_Error object, just return it.
if (is_a($addresses, 'PEAR_Error')) { if (PEAR::isError($addresses)) {
return $addresses; return $addresses;
} }

83
extlib/Mail/RFC822.php Executable file → Normal file
View File

@ -1,48 +1,37 @@
<?php <?php
/** // +-----------------------------------------------------------------------+
* RFC 822 Email address list validation Utility // | Copyright (c) 2001-2002, Richard Heyes |
* // | All rights reserved. |
* PHP versions 4 and 5 // | |
* // | Redistribution and use in source and binary forms, with or without |
* LICENSE: // | modification, are permitted provided that the following conditions |
* // | are met: |
* Copyright (c) 2001-2010, Richard Heyes // | |
* All rights reserved. // | o Redistributions of source code must retain the above copyright |
* // | notice, this list of conditions and the following disclaimer. |
* Redistribution and use in source and binary forms, with or without // | o Redistributions in binary form must reproduce the above copyright |
* modification, are permitted provided that the following conditions // | notice, this list of conditions and the following disclaimer in the |
* are met: // | documentation and/or other materials provided with the distribution.|
* // | o The names of the authors may not be used to endorse or promote |
* o Redistributions of source code must retain the above copyright // | products derived from this software without specific prior written |
* notice, this list of conditions and the following disclaimer. // | permission. |
* o Redistributions in binary form must reproduce the above copyright // | |
* notice, this list of conditions and the following disclaimer in the // | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
* documentation and/or other materials provided with the distribution. // | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
* o The names of the authors may not be used to endorse or promote // | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
* products derived from this software without specific prior written // | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
* permission. // | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
* // | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // | |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // +-----------------------------------------------------------------------+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // | Authors: Richard Heyes <richard@phpguru.org> |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // | Chuck Hagenbuch <chuck@horde.org> |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // +-----------------------------------------------------------------------+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @category Mail
* @package Mail
* @author Richard Heyes <richard@phpguru.org>
* @author Chuck Hagenbuch <chuck@horde.org
* @copyright 2001-2010 Richard Heyes
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version CVS: $Id: RFC822.php 294749 2010-02-08 08:22:25Z clockwerx $
* @link http://pear.php.net/package/Mail/
*/
/** /**
* RFC 822 Email address list validation Utility * RFC 822 Email address list validation Utility
@ -63,7 +52,7 @@
* *
* @author Richard Heyes <richard@phpguru.org> * @author Richard Heyes <richard@phpguru.org>
* @author Chuck Hagenbuch <chuck@horde.org> * @author Chuck Hagenbuch <chuck@horde.org>
* @version $Revision: 294749 $ * @version $Revision: 1.24 $
* @license BSD * @license BSD
* @package Mail * @package Mail
*/ */
@ -646,8 +635,8 @@ class Mail_RFC822 {
$comment = $this->_splitCheck($parts, ')'); $comment = $this->_splitCheck($parts, ')');
$comments[] = $comment; $comments[] = $comment;
// +2 is for the brackets // +1 is for the trailing )
$_mailbox = substr($_mailbox, strpos($_mailbox, '('.$comment)+strlen($comment)+2); $_mailbox = substr($_mailbox, strpos($_mailbox, $comment)+strlen($comment)+1);
} else { } else {
break; break;
} }

63
extlib/Mail/mail.php Executable file → Normal file
View File

@ -1,52 +1,27 @@
<?php <?php
/** //
* internal PHP-mail() implementation of the PEAR Mail:: interface. // +----------------------------------------------------------------------+
* // | PHP Version 4 |
* PHP versions 4 and 5 // +----------------------------------------------------------------------+
* // | Copyright (c) 1997-2003 The PHP Group |
* LICENSE: // +----------------------------------------------------------------------+
* // | This source file is subject to version 2.02 of the PHP license, |
* Copyright (c) 2010 Chuck Hagenbuch // | that is bundled with this package in the file LICENSE, and is |
* All rights reserved. // | available at through the world-wide-web at |
* // | http://www.php.net/license/2_02.txt. |
* Redistribution and use in source and binary forms, with or without // | If you did not receive a copy of the PHP license and are unable to |
* modification, are permitted provided that the following conditions // | obtain it through the world-wide-web, please send a note to |
* are met: // | license@php.net so we can mail you a copy immediately. |
* // +----------------------------------------------------------------------+
* o Redistributions of source code must retain the above copyright // | Author: Chuck Hagenbuch <chuck@horde.org> |
* notice, this list of conditions and the following disclaimer. // +----------------------------------------------------------------------+
* o Redistributions in binary form must reproduce the above copyright //
* notice, this list of conditions and the following disclaimer in the // $Id: mail.php,v 1.20 2007/10/06 17:00:00 chagenbu Exp $
* documentation and/or other materials provided with the distribution.
* o The names of the authors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @category Mail
* @package Mail
* @author Chuck Hagenbuch <chuck@horde.org>
* @copyright 2010 Chuck Hagenbuch
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version CVS: $Id: mail.php 294747 2010-02-08 08:18:33Z clockwerx $
* @link http://pear.php.net/package/Mail/
*/
/** /**
* internal PHP-mail() implementation of the PEAR Mail:: interface. * internal PHP-mail() implementation of the PEAR Mail:: interface.
* @package Mail * @package Mail
* @version $Revision: 294747 $ * @version $Revision: 1.20 $
*/ */
class Mail_mail extends Mail { class Mail_mail extends Mail {

64
extlib/Mail/mock.php Executable file → Normal file
View File

@ -1,53 +1,29 @@
<?php <?php
/** //
* Mock implementation // +----------------------------------------------------------------------+
* // | PHP Version 4 |
* PHP versions 4 and 5 // +----------------------------------------------------------------------+
* // | Copyright (c) 1997-2003 The PHP Group |
* LICENSE: // +----------------------------------------------------------------------+
* // | This source file is subject to version 2.02 of the PHP license, |
* Copyright (c) 2010 Chuck Hagenbuch // | that is bundled with this package in the file LICENSE, and is |
* All rights reserved. // | available at through the world-wide-web at |
* // | http://www.php.net/license/2_02.txt. |
* Redistribution and use in source and binary forms, with or without // | If you did not receive a copy of the PHP license and are unable to |
* modification, are permitted provided that the following conditions // | obtain it through the world-wide-web, please send a note to |
* are met: // | license@php.net so we can mail you a copy immediately. |
* // +----------------------------------------------------------------------+
* o Redistributions of source code must retain the above copyright // | Author: Chuck Hagenbuch <chuck@horde.org> |
* notice, this list of conditions and the following disclaimer. // +----------------------------------------------------------------------+
* o Redistributions in binary form must reproduce the above copyright //
* notice, this list of conditions and the following disclaimer in the // $Id: mock.php,v 1.1 2007/12/08 17:57:54 chagenbu Exp $
* documentation and/or other materials provided with the distribution. //
* o The names of the authors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @category Mail
* @package Mail
* @author Chuck Hagenbuch <chuck@horde.org>
* @copyright 2010 Chuck Hagenbuch
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version CVS: $Id: mock.php 294747 2010-02-08 08:18:33Z clockwerx $
* @link http://pear.php.net/package/Mail/
*/
/** /**
* Mock implementation of the PEAR Mail:: interface for testing. * Mock implementation of the PEAR Mail:: interface for testing.
* @access public * @access public
* @package Mail * @package Mail
* @version $Revision: 294747 $ * @version $Revision: 1.1 $
*/ */
class Mail_mock extends Mail { class Mail_mock extends Mail {

64
extlib/Mail/null.php Executable file → Normal file
View File

@ -1,53 +1,29 @@
<?php <?php
/** //
* Null implementation of the PEAR Mail interface // +----------------------------------------------------------------------+
* // | PHP Version 4 |
* PHP versions 4 and 5 // +----------------------------------------------------------------------+
* // | Copyright (c) 1997-2003 The PHP Group |
* LICENSE: // +----------------------------------------------------------------------+
* // | This source file is subject to version 2.02 of the PHP license, |
* Copyright (c) 2010 Phil Kernick // | that is bundled with this package in the file LICENSE, and is |
* All rights reserved. // | available at through the world-wide-web at |
* // | http://www.php.net/license/2_02.txt. |
* Redistribution and use in source and binary forms, with or without // | If you did not receive a copy of the PHP license and are unable to |
* modification, are permitted provided that the following conditions // | obtain it through the world-wide-web, please send a note to |
* are met: // | license@php.net so we can mail you a copy immediately. |
* // +----------------------------------------------------------------------+
* o Redistributions of source code must retain the above copyright // | Author: Phil Kernick <philk@rotfl.com.au> |
* notice, this list of conditions and the following disclaimer. // +----------------------------------------------------------------------+
* o Redistributions in binary form must reproduce the above copyright //
* notice, this list of conditions and the following disclaimer in the // $Id: null.php,v 1.2 2004/04/06 05:19:03 jon Exp $
* documentation and/or other materials provided with the distribution. //
* o The names of the authors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @category Mail
* @package Mail
* @author Phil Kernick <philk@rotfl.com.au>
* @copyright 2010 Phil Kernick
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version CVS: $Id: null.php 294747 2010-02-08 08:18:33Z clockwerx $
* @link http://pear.php.net/package/Mail/
*/
/** /**
* Null implementation of the PEAR Mail:: interface. * Null implementation of the PEAR Mail:: interface.
* @access public * @access public
* @package Mail * @package Mail
* @version $Revision: 294747 $ * @version $Revision: 1.2 $
*/ */
class Mail_null extends Mail { class Mail_null extends Mail {

7
extlib/Mail/sendmail.php Executable file → Normal file
View File

@ -20,7 +20,7 @@
* Sendmail implementation of the PEAR Mail:: interface. * Sendmail implementation of the PEAR Mail:: interface.
* @access public * @access public
* @package Mail * @package Mail
* @version $Revision: 294744 $ * @version $Revision: 1.19 $
*/ */
class Mail_sendmail extends Mail { class Mail_sendmail extends Mail {
@ -117,7 +117,7 @@ class Mail_sendmail extends Mail {
if (is_a($recipients, 'PEAR_Error')) { if (is_a($recipients, 'PEAR_Error')) {
return $recipients; return $recipients;
} }
$recipients = implode(' ', array_map('escapeshellarg', $recipients)); $recipients = escapeShellCmd(implode(' ', $recipients));
$headerElements = $this->prepareHeaders($headers); $headerElements = $this->prepareHeaders($headers);
if (is_a($headerElements, 'PEAR_Error')) { if (is_a($headerElements, 'PEAR_Error')) {
@ -141,8 +141,7 @@ class Mail_sendmail extends Mail {
return PEAR::raiseError('From address specified with dangerous characters.'); return PEAR::raiseError('From address specified with dangerous characters.');
} }
$from = escapeshellarg($from); // Security bug #16200 $from = escapeShellCmd($from);
$mail = @popen($this->sendmail_path . (!empty($this->sendmail_args) ? ' ' . $this->sendmail_args : '') . " -f$from -- $recipients", 'w'); $mail = @popen($this->sendmail_path . (!empty($this->sendmail_args) ? ' ' . $this->sendmail_args : '') . " -f$from -- $recipients", 'w');
if (!$mail) { if (!$mail) {
return PEAR::raiseError('Failed to open sendmail [' . $this->sendmail_path . '] for execution.'); return PEAR::raiseError('Failed to open sendmail [' . $this->sendmail_path . '] for execution.');

73
extlib/Mail/smtp.php Executable file → Normal file
View File

@ -1,48 +1,21 @@
<?php <?php
/** //
* SMTP implementation of the PEAR Mail interface. Requires the Net_SMTP class. // +----------------------------------------------------------------------+
* // | PHP Version 4 |
* PHP versions 4 and 5 // +----------------------------------------------------------------------+
* // | Copyright (c) 1997-2003 The PHP Group |
* LICENSE: // +----------------------------------------------------------------------+
* // | This source file is subject to version 2.02 of the PHP license, |
* Copyright (c) 2010, Chuck Hagenbuch // | that is bundled with this package in the file LICENSE, and is |
* All rights reserved. // | available at through the world-wide-web at |
* // | http://www.php.net/license/2_02.txt. |
* Redistribution and use in source and binary forms, with or without // | If you did not receive a copy of the PHP license and are unable to |
* modification, are permitted provided that the following conditions // | obtain it through the world-wide-web, please send a note to |
* are met: // | license@php.net so we can mail you a copy immediately. |
* // +----------------------------------------------------------------------+
* o Redistributions of source code must retain the above copyright // | Authors: Chuck Hagenbuch <chuck@horde.org> |
* notice, this list of conditions and the following disclaimer. // | Jon Parise <jon@php.net> |
* o Redistributions in binary form must reproduce the above copyright // +----------------------------------------------------------------------+
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* o The names of the authors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @category HTTP
* @package HTTP_Request
* @author Jon Parise <jon@php.net>
* @author Chuck Hagenbuch <chuck@horde.org>
* @copyright 2010 Chuck Hagenbuch
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version CVS: $Id: smtp.php 294747 2010-02-08 08:18:33Z clockwerx $
* @link http://pear.php.net/package/Mail/
*/
/** Error: Failed to create a Net_SMTP object */ /** Error: Failed to create a Net_SMTP object */
define('PEAR_MAIL_SMTP_ERROR_CREATE', 10000); define('PEAR_MAIL_SMTP_ERROR_CREATE', 10000);
@ -69,7 +42,7 @@ define('PEAR_MAIL_SMTP_ERROR_DATA', 10006);
* SMTP implementation of the PEAR Mail interface. Requires the Net_SMTP class. * SMTP implementation of the PEAR Mail interface. Requires the Net_SMTP class.
* @access public * @access public
* @package Mail * @package Mail
* @version $Revision: 294747 $ * @version $Revision: 1.33 $
*/ */
class Mail_smtp extends Mail { class Mail_smtp extends Mail {
@ -305,16 +278,6 @@ class Mail_smtp extends Mail {
/* Send the message's headers and the body as SMTP data. */ /* Send the message's headers and the body as SMTP data. */
$res = $this->_smtp->data($textHeaders . "\r\n\r\n" . $body); $res = $this->_smtp->data($textHeaders . "\r\n\r\n" . $body);
list(,$args) = $this->_smtp->getResponse();
if (preg_match("/Ok: queued as (.*)/", $args, $queued)) {
$this->queued_as = $queued[1];
}
/* we need the greeting; from it we can extract the authorative name of the mail server we've really connected to.
* ideal if we're connecting to a round-robin of relay servers and need to track which exact one took the email */
$this->greeting = $this->_smtp->getGreeting();
if (is_a($res, 'PEAR_Error')) { if (is_a($res, 'PEAR_Error')) {
$error = $this->_error('Failed to send data', $res); $error = $this->_error('Failed to send data', $res);
$this->_smtp->rset(); $this->_smtp->rset();

44
extlib/Mail/smtpmx.php Executable file → Normal file
View File

@ -8,43 +8,19 @@
* *
* PHP versions 4 and 5 * PHP versions 4 and 5
* *
* LICENSE: * LICENSE: This source file is subject to version 3.0 of the PHP license
* * that is available through the world-wide-web at the following URI:
* Copyright (c) 2010, gERD Schaufelberger * http://www.php.net/license/3_0.txt. If you did not receive a copy of
* All rights reserved. * the PHP License and are unable to obtain it through the web, please
* * send a note to license@php.net so we can mail you a copy immediately.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* o Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* o Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* o The names of the authors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* @category Mail * @category Mail
* @package Mail_smtpmx * @package Mail_smtpmx
* @author gERD Schaufelberger <gerd@php-tools.net> * @author gERD Schaufelberger <gerd@php-tools.net>
* @copyright 2010 gERD Schaufelberger * @copyright 1997-2005 The PHP Group
* @license http://opensource.org/licenses/bsd-license.php New BSD License * @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: smtpmx.php 294747 2010-02-08 08:18:33Z clockwerx $ * @version CVS: $Id: smtpmx.php,v 1.2 2007/10/06 17:00:00 chagenbu Exp $
* @link http://pear.php.net/package/Mail/ * @see Mail
*/ */
require_once 'Net/SMTP.php'; require_once 'Net/SMTP.php';
@ -56,7 +32,7 @@ require_once 'Net/SMTP.php';
* @access public * @access public
* @author gERD Schaufelberger <gerd@php-tools.net> * @author gERD Schaufelberger <gerd@php-tools.net>
* @package Mail * @package Mail
* @version $Revision: 294747 $ * @version $Revision: 1.2 $
*/ */
class Mail_smtpmx extends Mail { class Mail_smtpmx extends Mail {