[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Definition of eZSMTPTransport class 4 // 5 // Created on: <10-Dec-2002 15:20:20 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 ezsmtptransport.php 30 */ 31 32 /*! 33 \class eZSMTPTransport ezsmtptransport.php 34 \brief The class eZSMTPTransport does 35 36 */ 37 38 include_once ( 'lib/ezutils/classes/ezmailtransport.php' ); 39 40 class eZSMTPTransport extends eZMailTransport 41 { 42 /*! 43 Constructor 44 */ 45 function eZSMTPTransport() 46 { 47 } 48 49 /*! 50 \reimp 51 */ 52 function sendMail( &$mail ) 53 { 54 $ini =& eZINI::instance(); 55 $parameters = array(); 56 $parameters['host'] = $ini->variable( 'MailSettings', 'TransportServer' ); 57 $parameters['helo'] = $ini->variable( 'MailSettings', 'TransportServer' ); 58 $parameters['port'] = $ini->variable( 'MailSettings', 'TransportPort' ); 59 $user = $ini->variable( 'MailSettings', 'TransportUser' ); 60 $password = $ini->variable( 'MailSettings', 'TransportPassword' ); 61 if ( $user and 62 $password ) 63 { 64 $parameters['auth'] = true; 65 $parameters['user'] = $user; 66 $parameters['pass'] = $password; 67 } 68 69 /* If email sender hasn't been specified or is empty 70 * we substitute it with either MailSettings.EmailSender or AdminEmail. 71 */ 72 if ( !$mail->senderText() ) 73 { 74 $emailSender = $ini->variable( 'MailSettings', 'EmailSender' ); 75 if ( !$emailSender ) 76 $emailSender = $ini->variable( 'MailSettings', 'AdminEmail' ); 77 78 eZMail::extractEmail( $emailSender, $emailSenderAddress, $emailSenderName ); 79 80 if ( !eZMail::validate( $emailSenderAddress ) ) 81 $emailSender = false; 82 83 if ( $emailSender ) 84 $mail->setSenderText( $emailSender ); 85 } 86 87 $sendData = array(); 88 // $sendData['from'] = $mail->senderText(); 89 $from = $mail->sender(); 90 $sendData['from'] = isset( $from['email'] ) ? $from['email'] : ''; 91 $sendData["recipients"] = $mail->receiverTextList(); 92 $sendData['CcRecipients'] = $mail->ccReceiverTextList(); 93 $sendData['BccRecipients'] = $mail->bccReceiverTextList(); 94 $sendData['headers'] = $mail->headerTextList(); 95 $sendData['body'] = $mail->body(); 96 97 include_once ( "lib/ezutils/classes/ezsmtp.php" ); 98 99 $smtp = smtp::connect( $parameters ); 100 if ( $smtp ) 101 { 102 $result = $smtp->send( $sendData ); 103 $mailSent = true; 104 if ( isset( $smtp->errors ) and is_array( $smtp->errors ) and count( $smtp->errors ) > 0 ) 105 { 106 $mailSent = false; 107 foreach ( $smtp->errors as $error ) 108 { 109 eZDebug::writeError( "Error sending SMTP mail: " . $error, "eZSMTPTransport::sendMail()" ); 110 } 111 } 112 $smtp->quit(); 113 } 114 else 115 $mailSent = false; 116 return $mailSent; 117 } 118 } 119 120 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |