Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, October 14, 2026

Diff for Metafox/lib/Mail/mail.php between version 1.4 and 1.5

version 1.4, 2006/03/29 09:23:13 version 1.5, 2011/06/17 13:56:39
Line 1 
Line 1 
 <?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,      |   *
 // | that is bundled with this package in the file LICENSE, and is        |   * Copyright (c) 2010 Chuck Hagenbuch
 // | available at through the world-wide-web at                           |   * All rights reserved.
 // | http://www.php.net/license/2_02.txt.                                 |   *
 // | If you did not receive a copy of the PHP license and are unable to   |   * Redistribution and use in source and binary forms, with or without
 // | obtain it through the world-wide-web, please send a note to          |   * modification, are permitted provided that the following conditions
 // | license@php.net so we can mail you a copy immediately.               |   * are met:
 // +----------------------------------------------------------------------+   *
 // | Author: Chuck Hagenbuch <chuck@horde.org>                            |   * 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
 // $Id$   *   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
    * @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$
    * @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.
Line 41  class Mail_mail extends Mail {
Line 66  class Mail_mail extends Mail {
      */       */
     function Mail_mail($params = null)      function Mail_mail($params = null)
     {      {
         /* The other mail implementations accept parameters as arrays.          // The other mail implementations accept parameters as arrays.
          * In the interest of being consistent, explode an array into          // In the interest of being consistent, explode an array into
          * a string of parameter arguments. */          // a string of parameter arguments.
         if (is_array($params)) {          if (is_array($params)) {
             $this->_params = join(' ', $params);              $this->_params = join(' ', $params);
         } else {          } else {
Line 54  class Mail_mail extends Mail {
Line 79  class Mail_mail extends Mail {
          * line arguments, we can't guarantee the use of the standard           * line arguments, we can't guarantee the use of the standard
          * "\r\n" separator.  Instead, we use the system's native line           * "\r\n" separator.  Instead, we use the system's native line
          * separator. */           * separator. */
         $this->sep = (strpos(PHP_OS, 'WIN') === false) ? "\n" : "\r\n";          if (defined('PHP_EOL')) {
               $this->sep = PHP_EOL;
           } else {
               $this->sep = (strpos(PHP_OS, 'WIN') === false) ? "\n" : "\r\n";
           }
     }      }
   
         /**      /**
      * Implements Mail_mail::send() function using php's built-in mail()       * Implements Mail_mail::send() function using php's built-in mail()
      * command.       * command.
      *       *
Line 85  class Mail_mail extends Mail {
Line 114  class Mail_mail extends Mail {
      */       */
     function send($recipients, $headers, $body)      function send($recipients, $headers, $body)
     {      {
           if (!is_array($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)) {
             $recipients = implode(', ', $recipients);              $recipients = implode(', ', $recipients);
Line 98  class Mail_mail extends Mail {
Line 136  class Mail_mail extends Mail {
             unset($headers['Subject']);              unset($headers['Subject']);
         }          }
   
           // Also remove the To: header.  The mail() function will add its own
           // To: header based on the contents of $recipients.
           unset($headers['To']);
   
         // Flatten the headers out.          // Flatten the headers out.
         $headerElements = $this->prepareHeaders($headers);          $headerElements = $this->prepareHeaders($headers);
         if (PEAR::isError($headerElements)) {          if (is_a($headerElements, 'PEAR_Error')) {
             return $headerElements;              return $headerElements;
         }          }
         list(, $text_headers) = $headerElements;          list(, $text_headers) = $headerElements;
   
         /*          // We only use mail()'s optional fifth parameter if the additional
          * We only use mail()'s optional fifth parameter if the additional          // parameters have been provided and we're not running in safe mode.
          * parameters have been provided and we're not running in safe mode.  
          */  
         if (empty($this->_params) || ini_get('safe_mode')) {          if (empty($this->_params) || ini_get('safe_mode')) {
             $result = mail($recipients, $subject, $body, $text_headers);              $result = mail($recipients, $subject, $body, $text_headers);
         } else {          } else {
Line 116  class Mail_mail extends Mail {
Line 156  class Mail_mail extends Mail {
                            $this->_params);                             $this->_params);
         }          }
   
         /*          // If the mail() function returned failure, we need to create a
          * If the mail() function returned failure, we need to create a          // PEAR_Error object and return it instead of the boolean result.
          * PEAR_Error object and return it instead of the boolean result.  
          */  
         if ($result === false) {          if ($result === false) {
             $result = PEAR::raiseError('mail() returned failure');              $result = PEAR::raiseError('mail() returned failure');
         }          }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top