Location: PHPKode > scripts > PHP-Lib-Xtreme > php-lib-xtreme/phpmailer.php
<?php
/** @defgroup phpmailergroup PHP-Mailer-Class
    PHP-Class for sending mails with PHP.
@{ */
/*!***********************************************************************
 *************************************************************************
 * \file            phpmailer.php
 *
 * \author          copyright 1999-2005 <br>
 *                  Kai Klenovsek  <br>
 *
 * \date            First Step: 2005-02-08 <br>
 *
 * \note <br>
 * \b LICENSE: <br>
 *      This library is free software; you can redistribute it and/or <br>
 *      modify it under the terms of the GNU Lesser General Public <br>
 *      License as published by the Free Software Foundation; either <br>
 *      version 2.1 of the License, or (at your option) any later version. <br>
 *
 *      This library is distributed in the hope that it will be useful, <br>
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of <br>
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU <br>
 *      Lesser General Public License for more details. <br>
 *
 *      You should have received a copy of the GNU Lesser General Public <br>
 *      License along with this library; if not, write to the Free Software <br>
 *      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA <br>
 *
 * \b NOTES: 
 *       
 * \todo  
 *               
 * \bug
 *           
 * \b CHANGE \b HISTORY: <br>
 *   
 *      <b>- Kai K. / 2005-07-13</b>   
 *          - Error log to error logfile implemented.
 *
 *     <b>- Kai K. / 2005-04-13</b>   
 *             - Error message handler implemented.
 *
***************************************************************************
***************************************************************************/

if ( !defined("PHP-MAILER") )
{
define("PHP-MAILER", "php_mailer_class");



/***********************************************************************
* 
* DEFINES
*  
***********************************************************************/

define("PHPMAILERMODULNAME", "[MODUL->PHPMAILER]:");



class phpmailer extends mimemail
{
    /**********************************************************************
    * 
    * PRIVATE VARS
    *  
    **********************************************************************/
    
    var $php_error_hdl = 0;                    /*!< Error message handler */


    /**********************************************************************
    *    
    * PUBLIC FUNCTIONS
    *
    **********************************************************************/
    
    // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    /*! \fn function phpmailer()
     *  \brief Class Constructor */
    
    function phpmailer()
    
    // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    {
        $this->php_error_hdl = new msghandler();
        
        // Init standard mime header
        $this->mime_init_header();
    }
    


    // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    /*! \fn function _phpmailer()
     *  \brief Class Destructor */
    
    function _phpmailer()
    
    // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    {

    }

 
    
    //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    /*! \fn function php_flush_errors()
     *  \brief Will flush the complete php mailer error buffer
     *  \return State = true or false */
    
    function php_flush_errors()
    
    //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    {
        return ( $this->php_error_hdl->msg_flushlist() );   
    }
    
    

    // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    /*! \fn function php_get_errorlist( ) 
     *  \brief Return error string list
     *  \return Error list array */
    
    function php_get_errorlist( )
    
    // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    {
        return( $this->php_error_hdl->msg_getlist() );            
    }

     
        
    // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    /*! \fn function php_do_send( $type )
     *  \brief Sends the email 
     *  \param  $type = "text/plain" or "text/html"  
     *  \return State = true or false */
    
    function php_do_send( $type="text/plain" )
   
    // ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    {
        // First we have to generate the mime header
        $this->mime_generate_header( $type );        
        
        $receiver_str = $this->mime_mailto[0].";";
        
        // Generate receiver string
        for ( $loop=1; $loop <= sizeof($this->mime_mailto)-1; $loop++ )
            $receiver_str .= $this->mime_mailto[$loop].";";
                
        if ( @mail( $receiver_str, "","", $this->mime_header) )
            return ( true );
                    
       $error_msg = PHPLIBEX_PREFIX.PHPMAILERMODULNAME." Cant sent mail in phpmailer->do_send()";
       $this->php_error_hdl->msg_addfull( $error_msg, PHPLIBEX_ERROR_LOG );       
       
        return ( false );
    }
  
} // END CLASS PHPMAILER
} // END IF PHP-MAILER
/** @} */
?>
Return current item: PHP-Lib-Xtreme