|
eZ Publish
[trunk]
|
00001 <?php 00002 /** 00003 * File containing the eZMailTransport class. 00004 * 00005 * @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved. 00006 * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2 00007 * @version //autogentag// 00008 * @package lib 00009 */ 00010 00011 /*! 00012 \class eZMailTransport ezmailtransport.php 00013 \brief Interface for mail transport handling 00014 00015 */ 00016 00017 class eZMailTransport 00018 { 00019 /*! 00020 Constructor 00021 */ 00022 function eZMailTransport() 00023 { 00024 } 00025 00026 /*! 00027 Tries to send the contents of the email object \a $mail and 00028 returns \c true if succesful. 00029 */ 00030 function sendMail( eZMail $mail ) 00031 { 00032 return false; 00033 } 00034 00035 /*! 00036 \static 00037 Sends the contents of the email object \a $mail using the default transport. 00038 */ 00039 static function send( eZMail $mail ) 00040 { 00041 $ini = eZINI::instance(); 00042 00043 $transportType = trim( $ini->variable( 'MailSettings', 'Transport' ) ); 00044 00045 $optionArray = array( 'iniFile' => 'site.ini', 00046 'iniSection' => 'MailSettings', 00047 'iniVariable' => 'TransportAlias', 00048 'handlerIndex' => strtolower( $transportType ) ); 00049 $options = new ezpExtensionOptions( $optionArray ); 00050 $transportClass = eZExtension::getHandlerClass( $options ); 00051 00052 if ( !is_object( $transportClass ) ) 00053 { 00054 eZDebug::writeError( "No class available for mail transport type '$transportType', cannot send mail", __METHOD__ ); 00055 } 00056 return $transportClass->sendMail( $mail ); 00057 } 00058 } 00059 00060 ?>