[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/ezutils/classes/ -> ezsendmailtransport.php (source)

   1  <?php
   2  //
   3  // Definition of eZSendmailTransport class
   4  //
   5  // Created on: <10-Dec-2002 14:41:22 amos>
   6  //
   7  // SOFTWARE NAME: eZ publish
   8  // SOFTWARE RELEASE: 3.9.0
   9  // BUILD VERSION: 17785
  10  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
  11  // SOFTWARE LICENSE: GNU General Public License v2.0
  12  // NOTICE: >
  13  //   This program is free software; you can redistribute it and/or
  14  //   modify it under the terms of version 2.0  of the GNU General
  15  //   Public License as published by the Free Software Foundation.
  16  //
  17  //   This program is distributed in the hope that it will be useful,
  18  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  19  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20  //   GNU General Public License for more details.
  21  //
  22  //   You should have received a copy of version 2.0 of the GNU General
  23  //   Public License along with this program; if not, write to the Free
  24  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  25  //   MA 02110-1301, USA.
  26  //
  27  //
  28  
  29  /*! \file ezsendmailtransport.php
  30  */
  31  
  32  /*!
  33    \class eZSendmailTransport ezsendmailtransport.php
  34    \brief Sends the email message to sendmail which takes care of sending the actual message.
  35  
  36    Uses the mail() function in PHP to pass the email to the sendmail system.
  37  
  38  */
  39  
  40  include_once ( 'lib/ezutils/classes/ezmailtransport.php' );
  41  
  42  class eZSendmailTransport extends eZMailTransport
  43  {
  44      /*!
  45       Constructor
  46      */
  47      function eZSendmailTransport()
  48      {
  49      }
  50  
  51      /*!
  52       \reimp
  53      */
  54      function sendMail( &$mail )
  55      {
  56          $ini =& eZINI::instance();
  57          $sendmailOptions = '';
  58          $emailFrom = $mail->sender();
  59          $emailSender = isset( $emailFrom['email'] ) ? $emailFrom['email'] : false;
  60          if ( !$emailSender || count( $emailSender) <= 0 )
  61              $emailSender = $ini->variable( 'MailSettings', 'EmailSender' );
  62          if ( !$emailSender )
  63              $emailSender = $ini->variable( 'MailSettings', 'AdminEmail' );
  64          if ( !eZMail::validate( $emailSender ) )
  65              $emailSender = false;
  66  
  67          $isSafeMode = ini_get( 'safe_mode' ) != 0;
  68  
  69          $sendmailOptionsArray = $ini->variable( 'MailSettings', 'SendmailOptions' );
  70          if( is_array($sendmailOptionsArray) )
  71              $sendmailOptions = implode( ' ', $sendmailOptionsArray );
  72          elseif( !is_string($sendmailOptionsArray) )
  73              $sendmailOptions = $sendmailOptionsArray;
  74          if ( !$isSafeMode and
  75               $emailSender )
  76              $sendmailOptions .= ' -f'. $emailSender;
  77  
  78          if ( $isSafeMode and
  79               $emailSender and
  80               $mail->sender() == false )
  81              $mail->setSenderText( $emailSender );
  82          $message = $mail->body();
  83          $extraHeaders = $mail->headerText( array( 'exclude-headers' => array( 'To', 'Subject' ) ) );
  84          return mail( $mail->receiverEmailText(), $mail->subject(), $message, $extraHeaders, $sendmailOptions );
  85      }
  86  }
  87  
  88  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7