Post Reply 
 
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please help decode: IonCube
06-24-2012, 05:38 PM
Post: #11
RE: Please help decode: IonCube
(06-23-2012 08:46 PM)kingofseo Wrote:  
(06-23-2012 06:32 PM)trytofly Wrote:  
(06-23-2012 04:07 PM)kingofseo Wrote:  
(06-23-2012 02:35 PM)trytofly Wrote:  Thanks guys!


Left 1 error:
Fatal error: Cannot use object of type mails as array in /home/repo/public_html/skevo/classes/mails.php on line 363


mails.php


Code:
<?php
/*********************/
/*                   */
/*  Version : 5.1.0  */
/*  Author  : RM     */
/*  Comment : 071223 */
/*                   */
/*********************/

class mails
{

    public function mails( )
    {
        $this->mail_template = "";
        $this->to = "";
        $this->to_name = "";
        $this->from = "";
        $this->from_name = "";
        $this->subject = "";
        $this->message = "";
    }

    public function init( $mail = "", $name = "", $from = "", $from_name = "" )
    {
        global $settings;
        if ( $mail )
        {
            $this->to = $mail;
        }
        else
        {
            $this->to = $settings['admin_email'];
        }
        if ( $name )
        {
            $this->to_name = $name;
        }
        else
        {
            $this->to_name = $settings['admin_name'];
        }
        if ( $from )
        {
            $this->from = $from;
        }
        else
        {
            $this->from = $settings['admin_email'];
        }
        if ( $from_name )
        {
            $this->from_name = $from_name;
        }
        else
        {
            $this->from_name = $settings['admin_name'];
        }
        $this->to = $this->safe( $this->to );
        if ( $this->from )
        {
            $from = $this->safe( $this->from );
        }
        if ( $this->from_name )
        {
            $this->from_name = $this->safe( $this->from_name );
        }
        if ( $this->to != $settings['admin_email'] && $this->from != $settings['admin_email'] )
        {
            global $mail_settings;
            if ( empty( $mail_settings ) )
            {
                $mail_settings = settings::getMailSettings( );
            }
            $this->bcc = $mail_settings['bcc_to'];
        }
        else
        {
            $this->bcc = "";
        }
    }

    public function setsubject( $subject )
    {
        $this->subject = $subject;
    }

    public function setmessage( $msg )
    {
        $this->message = $msg;
    }

    public function setfrom( $str )
    {
        $this->from = $this->safe( $str );
    }

    public function setfromname( $str )
    {
        $this->from_name = $this->safe( $str );
    }

    public function getval( $val )
    {
        return $this->array[$val];
    }

    public function send( )
    {
        $result = $this->send_mail( );
        return $result;
    }

    public function send_mail( )
    {
        global $lng;
        if ( strtoupper( substr( PHP_OS, 0, 3 ) ) == "WIN" )
        {
            $newLine = "\r\n";
        }
        else
        {
            $newLine = "\n";
        }
        $crlf = "\r\n";
        global $appearance_settings;
        global $settings;
        global $mail_settings;
        $charset = $appearance_settings['charset'];
        $admin_name = $settings['admin_name'];
        $admin_email = $settings['admin_email'];
        $site_name = $settings['site_name'];
        if ( empty( $mail_settings ) )
        {
            $mail_settings = settings::getMailSettings( );
        }
        $use_smtp_auth = $mail_settings['use_smtp_auth'];
        $html_mails = $mail_settings['html_mails'];
        $headers = "";
        $headers_bcc = "";
        $mime_boundary = "----MIME-Boundary-1-----";
        $headers .= "From: ".$this->from_name." <".$this->from.">{$crlf}";
        $headers .= "Reply-To: ".$this->from_name." <".$this->from.">{$crlf}";
        $headers .= "Message-ID: <".time( )."-".$this->from.">{$crlf}";
        if ( !$use_smtp_auth )
        {
            $headers .= "X-Mailer: PHP v".phpversion( ).$crlf;
        }
        $headers .= "MIME-Version: 1.0".$crlf;
        if ( $html_mails )
        {
            $headers .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"".$crlf;
        }
        else
        {
            $headers .= "Content-type: text/plain; charset=".$charset.$crlf;
        }
        $message = $this->message;
        if ( $html_mails )
        {
            $this->message = "";
            $this->message .= "--{$mime_boundary}".$newLine;
            $this->message .= "Content-Type: text/plain; charset={$charset}".$newLine;
            $this->message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
            $this->message .= $this->html2plain( $message, $newLine ).$newLine.$newLine;
            $email_css = $this->readEmailCSS( );
            $this->message .= "--{$mime_boundary}".$newLine;
            $this->message .= "Content-Type: text/html; charset={$charset}".$newLine;
            $this->message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
            $this->message .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
            $this->message .= "<html>".$newLine."<head></head>".$newLine."<body>";
            $this->message .= "<style type=\"text/css\"><!--";
            $this->message .= $email_css;
            $this->message .= "--></style>";
            $this->message .= stripslashes( $message );
            $this->message .= "</body>".$newLine."</html>".$newLine;
            $this->message .= "--{$mime_boundary}--".$newLine.$newLine;
        }
        else
        {
            $this->message = $this->html2plain( $message, $newLine ).$newLine.$newLine;
        }
        if ( $this->bcc )
        {
            $headers_bcc .= "From: ".$admin_name." <".$admin_email.">{$crlf}";
            $headers_bcc .= "Reply-To: ".$admin_name." <".$admin_email.">{$crlf}";
            $headers_bcc .= "Message-ID: <".time( )."-".$this->from.">{$crlf}";
            if ( !$use_smtp_auth )
            {
                $headers_bcc .= "X-Mailer: PHP v".phpversion( ).$crlf;
            }
            $headers_bcc .= "MIME-Version: 1.0".$crlf;
            if ( $html_mails )
            {
                $headers_bcc .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"".$crlf;
            }
            else
            {
                $headers_bcc .= "Content-type: text/plain; charset=".$charset.$crlf;
            }
            $bcc_subject = $lng['bcc_mails']['subject'].$this->subject;
            $message .= "<br/><br/>IP: ".$_SERVER['REMOTE_ADDR'];
            if ( $html_mails )
            {
                $bcc_message = "--{$mime_boundary}".$newLine;
                $bcc_message .= "Content-Type: text/plain; charset={$charset}".$newLine;
                $bcc_message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
                $bcc_message .= $lng['bcc_mails']['from'].$this->from_name." ".$this->from.$newLine;
                $bcc_message .= $lng['bcc_mails']['to'].$this->to_name." ".$this->to.$newLine.$newLine;
                $bcc_message .= $this->html2plain( $message, $newLine ).$newLine.$newLine;
                $email_css = $this->readEmailCSS( );
                $bcc_message .= "--{$mime_boundary}".$newLine;
                $bcc_message .= "Content-Type: text/html; charset={$charset}".$newLine;
                $bcc_message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
                $bcc_message .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
                $bcc_message .= "<html>".$newLine."<head></head>".$newLine."<body>";
                $bcc_message .= "<style type=\"text/css\">";
                $bcc_message .= $email_css;
                $bcc_message .= "</style>";
                $bcc_message .= $lng['bcc_mails']['from'].$this->from_name." ".$this->from."<br/>";
                $bcc_message .= $lng['bcc_mails']['to'].$this->to_name." ".$this->to."<br/><br/>";
                $bcc_message .= stripslashes( $message );
                $bcc_message .= "</body>".$newLine."</html>".$newLine;
                $bcc_message .= "--{$mime_boundary}--".$newLine.$newLine;
            }
            else
            {
                $bcc_message = $this->html2plain( $message, $newLine ).$newLine.$newLine;
            }
        }
        global $emails_avoid_bare_lfs;
        if ( $emails_avoid_bare_lfs )
        {
            $this->message = preg_replace( "#(?<!\r)\n#si", "\r\n", $this->message );
            $headers = preg_replace( "#(?<!\r)\n#si", "\r\n", $headers );
        }
        if ( $use_smtp_auth )
        {
            if ( $this->bcc )
            {
                $this->send_auth_email( $admin_email, $this->bcc, $bcc_subject, $bcc_message, $headers_bcc, $mail_settings );
            }
            if ( $this->send_auth_email( $this->from, $this->to, $this->subject, $this->message, $headers, $mail_settings ) )
            {
                return 1;
            }
            return 0;
        }
        if ( $this->bcc )
        {
            mail( $this->bcc, $bcc_subject, $bcc_message, $headers_bcc );
        }
        if ( mail( $this->to, $this->subject, $this->message, $headers ) )
        {
            return 1;
        }
        return 0;
    }

    public function send_auth_email( $from, $to, $subject, $message, $headers, $mail_settings )
    {
        $smtpServer = $mail_settings['smtp_server'];
        if ( $mail_settings['ssl'] )
        {
            $smtpServer = "ssl://".$mail_settings['smtp_server'];
        }
        $port = $mail_settings['port'];
        $username = $mail_settings['username'];
        $password = $mail_settings['password'];
        $localhost = "localhost";
        $newLine = "\r\n";
        $timeout = "10";
        global $settings;
        $admin_email = $settings['admin_email'];
        $smtpConnect = fsockopen( $smtpServer, $port, $errno, $errstr, $timeout );
        $smtpResponse = fgets( $smtpConnect, 515 );
        if ( empty( $smtpConnect ) )
        {
            $output = "Failed to connect: {$smtpResponse}";
            return 0;
        }
        $logArray['connection'] = "Connected: {$smtpResponse}";
        fputs( $smtpConnect, "EHLO {$localhost}".$newLine );
        $logArray['heloresponse'] = "";
        do
        {
            $smtpResponse = fgets( $smtpConnect, 1024 );
            $logArray['heloresponse'] .= "{$smtpResponse}";
        } while ( strpos( $smtpResponse, "-" ) != 0 );
        fputs( $smtpConnect, "AUTH LOGIN".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['authrequest'] = "{$smtpResponse}";
        fputs( $smtpConnect, base64_encode( $username ).$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['authusername'] = "{$smtpResponse}";
        fputs( $smtpConnect, base64_encode( $password ).$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['authpassword'] = "{$smtpResponse}";
        fputs( $smtpConnect, "MAIL FROM: <".$from.">".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['mailfromresponse'] = "{$smtpResponse}";
        fputs( $smtpConnect, "RCPT TO: <".$to.">".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['mailtoresponse'] = "{$smtpResponse}";
        fputs( $smtpConnect, "DATA".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['data1response'] = "{$smtpResponse}";
        fputs( $smtpConnect, "Subject: ".$subject."{$newLine}{$headers}{$newLine}{$newLine}".$message."{$newLine}.{$newLine}" );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['data2response'] = "{$smtpResponse}";
        fputs( $smtpConnect, "QUIT".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['quitresponse'] = "{$smtpResponse}";
        return 1;
    }

    public function safe( $name )
    {
        $version = phpversion( );
        $arr = explode( ".", $version );
        if ( $arr[0] < 5 )
        {
            return str_replace( array( "\r", "\n", "%0a", "%0d", "Content-Type:", "bcc:", "to:", "cc:", "BCC:", "TO:", "CC:" ), "", $name );
        }
        return str_ireplace( array( "\r", "\n", "%0a", "%0d", "Content-Type:", "bcc:", "to:", "cc:" ), "", $name );
    }

    public function html2plain( $str, $newLine )
    {
        $final = str_replace( "<br>", $newLine, $str );
        $final = str_replace( "<br/>", $newLine, $final );
        $final = str_replace( "<br />", $newLine, $final );
        $final = str_replace( "&amp;", "&", $final );
        $final = strip_tags( $final );
        return $final;
    }

    public function reademailcss( )
    {
        global $lng;
        global $config_abs_path;
        $this->file_path = $config_abs_path."/templates/style_emails.css";
        if ( !file_exists( $this->file_path ) )
        {
            return "";
        }
        if ( $fp = fopen( $this->file_path, "r" ) )
        {
            $content = fread( $fp, filesize( $this->file_path ) );
            fclose( $fp );
            return $content;
        }
        return "";
    }

    public function setmailtemplate( $template_name )
    {
        $this->mail_template = mail_templates::getVal( $template_name );
    }

    public function composeandsend( $template_name, $array_message, $array_subject )
    {
        if ( empty( $this['mail_template'] ) && $template_name )
        {
            $this->mail_template = mail_templates::getVal( $template_name );
        }
        $smarty_info = new Smarty( );
        $smarty_info = smartyshowdbval( $smarty_info );
        $smarty_info->assign( "value", $this->mail_template['subject'] );
        foreach ( $array_subject as $key => $value )
        {
            $smarty_info->assign( $key, $value );
        }
        $subject = $smarty_info->fetch( "db_template.html" );
        $smarty_info->assign( "value", $this->mail_template['content'] );
        foreach ( $array_message as $key => $value )
        {
            $smarty_info->assign( $key, $value );
        }
        $message = $smarty_info->fetch( "db_template.html" );
        $this->setSubject( $subject );
        $this->setMessage( $message );
        return $this->send( );
    }

}

?>

Thanks for help !

Try please

PHP Code:
<?php
error_reporting
(0);

class 
mails
{

    public function 
mails( )
    {
        
$this->mail_template "";
        
$this->to "";
        
$this->to_name "";
        
$this->from "";
        
$this->from_name "";
        
$this->subject "";
        
$this->message "";
    }

    public function 
init$mail ""$name ""$from ""$from_name "" )
    {
        global 
$settings;
        if ( 
$mail )
        {
            
$this->to $mail;
        }
        else
        {
            
$this->to $settings['admin_email'];
        }
        if ( 
$name )
        {
            
$this->to_name $name;
        }
        else
        {
            
$this->to_name $settings['admin_name'];
        }
        if ( 
$from )
        {
            
$this->from $from;
        }
        else
        {
            
$this->from $settings['admin_email'];
        }
        if ( 
$from_name )
        {
            
$this->from_name $from_name;
        }
        else
        {
            
$this->from_name $settings['admin_name'];
        }
        
$this->to $this->safe$this->to );
        if ( 
$this->from )
        {
            
$from $this->safe$this->from );
        }
        if ( 
$this->from_name )
        {
            
$this->from_name $this->safe$this->from_name );
        }
        if ( 
$this->to != $settings['admin_email'] && $this->from != $settings['admin_email'] )
        {
            global 
$mail_settings;
            if ( empty( 
$mail_settings ) )
            {
                
$mail_settings settings::getMailSettings( );
            }
            
$this->bcc $mail_settings['bcc_to'];
        }
        else
        {
            
$this->bcc "";
        }
    }

    public function 
setsubject$subject )
    {
        
$this->subject $subject;
    }

    public function 
setmessage$msg )
    {
        
$this->message $msg;
    }

    public function 
setfrom$str )
    {
        
$this->from $this->safe$str );
    }

    public function 
setfromname$str )
    {
        
$this->from_name $this->safe$str );
    }

    public function 
getval$val )
    {
        return 
$this->array[$val];
    }

    public function 
send( )
    {
        
$result $this->send_mail( );
        return 
$result;
    }

    public function 
send_mail( )
    {
        global 
$lng;
        if ( 
strtouppersubstrPHP_OS0) ) == "WIN" )
        {
            
$newLine "\r\n";
        }
        else
        {
            
$newLine "\n";
        }
        
$crlf "\r\n";
        global 
$appearance_settings;
        global 
$settings;
        global 
$mail_settings;
        
$charset $appearance_settings['charset'];
        
$admin_name $settings['admin_name'];
        
$admin_email $settings['admin_email'];
        
$site_name $settings['site_name'];
        if ( empty( 
$mail_settings ) )
        {
            
$mail_settings settings::getMailSettings( );
        }
        
$use_smtp_auth $mail_settings['use_smtp_auth'];
        
$html_mails $mail_settings['html_mails'];
        
$headers "";
        
$headers_bcc "";
        
$mime_boundary "----MIME-Boundary-1-----";
        
$headers .= "From: ".$this->from_name." <".$this->from.">{$crlf}";
        
$headers .= "Reply-To: ".$this->from_name." <".$this->from.">{$crlf}";
        
$headers .= "Message-ID: <".time( )."-".$this->from.">{$crlf}";
        if ( !
$use_smtp_auth )
        {
            
$headers .= "X-Mailer: PHP v".phpversion( ).$crlf;
        }
        
$headers .= "MIME-Version: 1.0".$crlf;
        if ( 
$html_mails )
        {
            
$headers .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"".$crlf;
        }
        else
        {
            
$headers .= "Content-type: text/plain; charset=".$charset.$crlf;
        }
        
$message $this->message;
        if ( 
$html_mails )
        {
            
$this->message "";
            
$this->message .= "--{$mime_boundary}".$newLine;
            
$this->message .= "Content-Type: text/plain; charset={$charset}".$newLine;
            
$this->message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
            
$this->message .= $this->html2plain$message$newLine ).$newLine.$newLine;
            
$email_css $this->readEmailCSS( );
            
$this->message .= "--{$mime_boundary}".$newLine;
            
$this->message .= "Content-Type: text/html; charset={$charset}".$newLine;
            
$this->message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
            
$this->message .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
            
$this->message .= "<html>".$newLine."<head></head>".$newLine."<body>";
            
$this->message .= "<style type=\"text/css\"><!--";
            
$this->message .= $email_css;
            
$this->message .= "--></style>";
            
$this->message .= stripslashes$message );
            
$this->message .= "</body>".$newLine."</html>".$newLine;
            
$this->message .= "--{$mime_boundary}--".$newLine.$newLine;
        }
        else
        {
            
$this->message $this->html2plain$message$newLine ).$newLine.$newLine;
        }
        if ( 
$this->bcc )
        {
            
$headers_bcc .= "From: ".$admin_name." <".$admin_email.">{$crlf}";
            
$headers_bcc .= "Reply-To: ".$admin_name." <".$admin_email.">{$crlf}";
            
$headers_bcc .= "Message-ID: <".time( )."-".$this->from.">{$crlf}";
            if ( !
$use_smtp_auth )
            {
                
$headers_bcc .= "X-Mailer: PHP v".phpversion( ).$crlf;
            }
            
$headers_bcc .= "MIME-Version: 1.0".$crlf;
            if ( 
$html_mails )
            {
                
$headers_bcc .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"".$crlf;
            }
            else
            {
                
$headers_bcc .= "Content-type: text/plain; charset=".$charset.$crlf;
            }
            
$bcc_subject $lng['bcc_mails']['subject'].$this->subject;
            
$message .= "<br/><br/>IP: ".$_SERVER['REMOTE_ADDR'];
            if ( 
$html_mails )
            {
                
$bcc_message "--{$mime_boundary}".$newLine;
                
$bcc_message .= "Content-Type: text/plain; charset={$charset}".$newLine;
                
$bcc_message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
                
$bcc_message .= $lng['bcc_mails']['from'].$this->from_name." ".$this->from.$newLine;
                
$bcc_message .= $lng['bcc_mails']['to'].$this->to_name." ".$this->to.$newLine.$newLine;
                
$bcc_message .= $this->html2plain$message$newLine ).$newLine.$newLine;
                
$email_css $this->readEmailCSS( );
                
$bcc_message .= "--{$mime_boundary}".$newLine;
                
$bcc_message .= "Content-Type: text/html; charset={$charset}".$newLine;
                
$bcc_message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
                
$bcc_message .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
                
$bcc_message .= "<html>".$newLine."<head></head>".$newLine."<body>";
                
$bcc_message .= "<style type=\"text/css\">";
                
$bcc_message .= $email_css;
                
$bcc_message .= "</style>";
                
$bcc_message .= $lng['bcc_mails']['from'].$this->from_name." ".$this->from."<br/>";
                
$bcc_message .= $lng['bcc_mails']['to'].$this->to_name." ".$this->to."<br/><br/>";
                
$bcc_message .= stripslashes$message );
                
$bcc_message .= "</body>".$newLine."</html>".$newLine;
                
$bcc_message .= "--{$mime_boundary}--".$newLine.$newLine;
            }
            else
            {
                
$bcc_message $this->html2plain$message$newLine ).$newLine.$newLine;
            }
        }
        global 
$emails_avoid_bare_lfs;
        if ( 
$emails_avoid_bare_lfs )
        {
            
$this->message preg_replace"#(?<!\r)\n#si""\r\n"$this->message );
            
$headers preg_replace"#(?<!\r)\n#si""\r\n"$headers );
        }
        if ( 
$use_smtp_auth )
        {
            if ( 
$this->bcc )
            {
                
$this->send_auth_email$admin_email$this->bcc$bcc_subject$bcc_message$headers_bcc$mail_settings );
            }
            if ( 
$this->send_auth_email$this->from$this->to$this->subject$this->message$headers$mail_settings ) )
            {
                return 
1;
            }
            return 
0;
        }
        if ( 
$this->bcc )
        {
            
mail$this->bcc$bcc_subject$bcc_message$headers_bcc );
        }
        if ( 
mail$this->to$this->subject$this->message$headers ) )
        {
            return 
1;
        }
        return 
0;
    }

    public function 
send_auth_email$from$to$subject$message$headers$mail_settings )
    {
        
$smtpServer $mail_settings['smtp_server'];
        if ( 
$mail_settings['ssl'] )
        {
            
$smtpServer "ssl://".$mail_settings['smtp_server'];
        }
        
$port $mail_settings['port'];
        
$username $mail_settings['username'];
        
$password $mail_settings['password'];
        
$localhost "localhost";
        
$newLine "\r\n";
        
$timeout "10";
        global 
$settings;
        
$admin_email $settings['admin_email'];
        
$smtpConnect fsockopen$smtpServer$port$errno$errstr$timeout );
        
$smtpResponse fgets$smtpConnect515 );
        if ( empty( 
$smtpConnect ) )
        {
            
$output "Failed to connect: {$smtpResponse}";
            return 
0;
        }
        
$logArray['connection'] = "Connected: {$smtpResponse}";
        
fputs$smtpConnect"EHLO {$localhost}".$newLine );
        
$logArray['heloresponse'] = "";
        do
        {
            
$smtpResponse fgets$smtpConnect1024 );
            
$logArray['heloresponse'] .= "{$smtpResponse}";
        } while ( 
strpos$smtpResponse"-" ) != );
        
fputs$smtpConnect"AUTH LOGIN".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['authrequest'] = "{$smtpResponse}";
        
fputs$smtpConnectbase64_encode$username ).$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['authusername'] = "{$smtpResponse}";
        
fputs$smtpConnectbase64_encode$password ).$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['authpassword'] = "{$smtpResponse}";
        
fputs$smtpConnect"MAIL FROM: <".$from.">".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['mailfromresponse'] = "{$smtpResponse}";
        
fputs$smtpConnect"RCPT TO: <".$to.">".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['mailtoresponse'] = "{$smtpResponse}";
        
fputs$smtpConnect"DATA".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['data1response'] = "{$smtpResponse}";
        
fputs$smtpConnect"Subject: ".$subject."{$newLine}{$headers}{$newLine}{$newLine}".$message."{$newLine}.{$newLine});
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['data2response'] = "{$smtpResponse}";
        
fputs$smtpConnect"QUIT".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['quitresponse'] = "{$smtpResponse}";
        return 
1;
    }

    public function 
safe$name )
    {
        
$version phpversion( );
        
$arr explode"."$version );
        if ( 
$arr[0] < )
        {
            return 
str_replace( array( "\r""\n""%0a""%0d""Content-Type:""bcc:""to:""cc:""BCC:""TO:""CC:" ), ""$name );
        }
        return 
str_ireplace( array( "\r""\n""%0a""%0d""Content-Type:""bcc:""to:""cc:" ), ""$name );
    }

    public function 
html2plain$str$newLine )
    {
        
$final str_replace"<br>"$newLine$str );
        
$final str_replace"<br/>"$newLine$final );
        
$final str_replace"<br />"$newLine$final );
        
$final str_replace"&amp;""&"$final );
        
$final strip_tags$final );
        return 
$final;
    }

    public function 
reademailcss( )
    {
        global 
$lng;
        global 
$config_abs_path;
        
$this->file_path $config_abs_path."/templates/style_emails.css";
        if ( !
file_exists$this->file_path ) )
        {
            return 
"";
        }
        if ( 
$fp fopen$this->file_path"r" ) )
        {
            
$content fread$fpfilesize$this->file_path ) );
            
fclose$fp );
            return 
$content;
        }
        return 
"";
    }

    public function 
setmailtemplate$template_name )
    {
        
$this->mail_template mail_templates::getVal$template_name );
    }

    public function 
composeandsend$template_name$array_message$array_subject )
    {
        if ( empty( 
$this['mail_template'] ) && $template_name )
        {
            
$this->mail_template mail_templates::getVal$template_name );
        }
        
$smarty_info = new Smarty( );
        
$smarty_info smartyshowdbval$smarty_info );
        
$smarty_info->assign"value"$this->mail_template['subject'] );
        foreach ( 
$array_subject as $key => $value )
        {
            
$smarty_info->assign$key$value );
        }
        
$subject $smarty_info->fetch"db_template.html" );
        
$smarty_info->assign"value"$this->mail_template['content'] );
        foreach ( 
$array_message as $key => $value )
        {
            
$smarty_info->assign$key$value );
        }
        
$message $smarty_info->fetch"db_template.html" );
        
$this->setSubject$subject );
        
$this->setMessage$message );
        return 
$this->send( );
    }

}

?>

Nope not working:

Fatal error: Cannot use object of type mails as array in /home/winny/public_html/repo/classes/mails.php on line 357

Code:
<?php
//error_reporting(0);

class mails
{

    public function mails( )
    {
        $this->mail_template = "";
        $this->to = "";
        $this->to_name = "";
        $this->from = "";
        $this->from_name = "";
        $this->subject = "";
        $this->message = "";
    }

    public function init( $mail = "", $name = "", $from = "", $from_name = "" )
    {
        global $settings;
        if ( $mail )
        {
            $this->to = $mail;
        }
        else
        {
            $this->to = $settings['admin_email'];
        }
        if ( $name )
        {
            $this->to_name = $name;
        }
        else
        {
            $this->to_name = $settings['admin_name'];
        }
        if ( $from )
        {
            $this->from = $from;
        }
        else
        {
            $this->from = $settings['admin_email'];
        }
        if ( $from_name )
        {
            $this->from_name = $from_name;
        }
        else
        {
            $this->from_name = $settings['admin_name'];
        }
        $this->to = $this->safe( $this->to );
        if ( $this->from )
        {
            $from = $this->safe( $this->from );
        }
        if ( $this->from_name )
        {
            $this->from_name = $this->safe( $this->from_name );
        }
        if ( $this->to != $settings['admin_email'] && $this->from != $settings['admin_email'] )
        {
            global $mail_settings;
            if ( empty( $mail_settings ) )
            {
                $mail_settings = settings::getMailSettings( );
            }
            $this->bcc = $mail_settings['bcc_to'];
        }
        else
        {
            $this->bcc = "";
        }
    }

    public function setsubject( $subject )
    {
        $this->subject = $subject;
    }

    public function setmessage( $msg )
    {
        $this->message = $msg;
    }

    public function setfrom( $str )
    {
        $this->from = $this->safe( $str );
    }

    public function setfromname( $str )
    {
        $this->from_name = $this->safe( $str );
    }

    public function getval( $val )
    {
        return $this->array[$val];
    }

    public function send( )
    {
        $result = $this->send_mail( );
        return $result;
    }

    public function send_mail( )
    {
        global $lng;
        if ( strtoupper( substr( PHP_OS, 0, 3 ) ) == "WIN" )
        {
            $newLine = "\r\n";
        }
        else
        {
            $newLine = "\n";
        }
        $crlf = "\r\n";
        global $appearance_settings;
        global $settings;
        global $mail_settings;
        $charset = $appearance_settings['charset'];
        $admin_name = $settings['admin_name'];
        $admin_email = $settings['admin_email'];
        $site_name = $settings['site_name'];
        if ( empty( $mail_settings ) )
        {
            $mail_settings = settings::getMailSettings( );
        }
        $use_smtp_auth = $mail_settings['use_smtp_auth'];
        $html_mails = $mail_settings['html_mails'];
        $headers = "";
        $headers_bcc = "";
        $mime_boundary = "----MIME-Boundary-1-----";
        $headers .= "From: ".$this->from_name." <".$this->from.">{$crlf}";
        $headers .= "Reply-To: ".$this->from_name." <".$this->from.">{$crlf}";
        $headers .= "Message-ID: <".time( )."-".$this->from.">{$crlf}";
        if ( !$use_smtp_auth )
        {
            $headers .= "X-Mailer: PHP v".phpversion( ).$crlf;
        }
        $headers .= "MIME-Version: 1.0".$crlf;
        if ( $html_mails )
        {
            $headers .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"".$crlf;
        }
        else
        {
            $headers .= "Content-type: text/plain; charset=".$charset.$crlf;
        }
        $message = $this->message;
        if ( $html_mails )
        {
            $this->message = "";
            $this->message .= "--{$mime_boundary}".$newLine;
            $this->message .= "Content-Type: text/plain; charset={$charset}".$newLine;
            $this->message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
            $this->message .= $this->html2plain( $message, $newLine ).$newLine.$newLine;
            $email_css = $this->readEmailCSS( );
            $this->message .= "--{$mime_boundary}".$newLine;
            $this->message .= "Content-Type: text/html; charset={$charset}".$newLine;
            $this->message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
            $this->message .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
            $this->message .= "<html>".$newLine."<head></head>".$newLine."<body>";
            $this->message .= "<style type=\"text/css\"><!--";
            $this->message .= $email_css;
            $this->message .= "--></style>";
            $this->message .= stripslashes( $message );
            $this->message .= "</body>".$newLine."</html>".$newLine;
            $this->message .= "--{$mime_boundary}--".$newLine.$newLine;
        }
        else
        {
            $this->message = $this->html2plain( $message, $newLine ).$newLine.$newLine;
        }
        if ( $this->bcc )
        {
            $headers_bcc .= "From: ".$admin_name." <".$admin_email.">{$crlf}";
            $headers_bcc .= "Reply-To: ".$admin_name." <".$admin_email.">{$crlf}";
            $headers_bcc .= "Message-ID: <".time( )."-".$this->from.">{$crlf}";
            if ( !$use_smtp_auth )
            {
                $headers_bcc .= "X-Mailer: PHP v".phpversion( ).$crlf;
            }
            $headers_bcc .= "MIME-Version: 1.0".$crlf;
            if ( $html_mails )
            {
                $headers_bcc .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"".$crlf;
            }
            else
            {
                $headers_bcc .= "Content-type: text/plain; charset=".$charset.$crlf;
            }
            $bcc_subject = $lng['bcc_mails']['subject'].$this->subject;
            $message .= "<br/><br/>IP: ".$_SERVER['REMOTE_ADDR'];
            if ( $html_mails )
            {
                $bcc_message = "--{$mime_boundary}".$newLine;
                $bcc_message .= "Content-Type: text/plain; charset={$charset}".$newLine;
                $bcc_message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
                $bcc_message .= $lng['bcc_mails']['from'].$this->from_name." ".$this->from.$newLine;
                $bcc_message .= $lng['bcc_mails']['to'].$this->to_name." ".$this->to.$newLine.$newLine;
                $bcc_message .= $this->html2plain( $message, $newLine ).$newLine.$newLine;
                $email_css = $this->readEmailCSS( );
                $bcc_message .= "--{$mime_boundary}".$newLine;
                $bcc_message .= "Content-Type: text/html; charset={$charset}".$newLine;
                $bcc_message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
                $bcc_message .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
                $bcc_message .= "<html>".$newLine."<head></head>".$newLine."<body>";
                $bcc_message .= "<style type=\"text/css\">";
                $bcc_message .= $email_css;
                $bcc_message .= "</style>";
                $bcc_message .= $lng['bcc_mails']['from'].$this->from_name." ".$this->from."<br/>";
                $bcc_message .= $lng['bcc_mails']['to'].$this->to_name." ".$this->to."<br/><br/>";
                $bcc_message .= stripslashes( $message );
                $bcc_message .= "</body>".$newLine."</html>".$newLine;
                $bcc_message .= "--{$mime_boundary}--".$newLine.$newLine;
            }
            else
            {
                $bcc_message = $this->html2plain( $message, $newLine ).$newLine.$newLine;
            }
        }
        global $emails_avoid_bare_lfs;
        if ( $emails_avoid_bare_lfs )
        {
            $this->message = preg_replace( "#(?<!\r)\n#si", "\r\n", $this->message );
            $headers = preg_replace( "#(?<!\r)\n#si", "\r\n", $headers );
        }
        if ( $use_smtp_auth )
        {
            if ( $this->bcc )
            {
                $this->send_auth_email( $admin_email, $this->bcc, $bcc_subject, $bcc_message, $headers_bcc, $mail_settings );
            }
            if ( $this->send_auth_email( $this->from, $this->to, $this->subject, $this->message, $headers, $mail_settings ) )
            {
                return 1;
            }
            return 0;
        }
        if ( $this->bcc )
        {
            mail( $this->bcc, $bcc_subject, $bcc_message, $headers_bcc );
        }
        if ( mail( $this->to, $this->subject, $this->message, $headers ) )
        {
            return 1;
        }
        return 0;
    }

    public function send_auth_email( $from, $to, $subject, $message, $headers, $mail_settings )
    {
        $smtpServer = $mail_settings['smtp_server'];
        if ( $mail_settings['ssl'] )
        {
            $smtpServer = "ssl://".$mail_settings['smtp_server'];
        }
        $port = $mail_settings['port'];
        $username = $mail_settings['username'];
        $password = $mail_settings['password'];
        $localhost = "localhost";
        $newLine = "\r\n";
        $timeout = "10";
        global $settings;
        $admin_email = $settings['admin_email'];
        $smtpConnect = fsockopen( $smtpServer, $port, $errno, $errstr, $timeout );
        $smtpResponse = fgets( $smtpConnect, 515 );
        if ( empty( $smtpConnect ) )
        {
            $output = "Failed to connect: {$smtpResponse}";
            return 0;
        }
        $logArray['connection'] = "Connected: {$smtpResponse}";
        fputs( $smtpConnect, "EHLO {$localhost}".$newLine );
        $logArray['heloresponse'] = "";
        do
        {
            $smtpResponse = fgets( $smtpConnect, 1024 );
            $logArray['heloresponse'] .= "{$smtpResponse}";
        } while ( strpos( $smtpResponse, "-" ) != 0 );
        fputs( $smtpConnect, "AUTH LOGIN".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['authrequest'] = "{$smtpResponse}";
        fputs( $smtpConnect, base64_encode( $username ).$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['authusername'] = "{$smtpResponse}";
        fputs( $smtpConnect, base64_encode( $password ).$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['authpassword'] = "{$smtpResponse}";
        fputs( $smtpConnect, "MAIL FROM: <".$from.">".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['mailfromresponse'] = "{$smtpResponse}";
        fputs( $smtpConnect, "RCPT TO: <".$to.">".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['mailtoresponse'] = "{$smtpResponse}";
        fputs( $smtpConnect, "DATA".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['data1response'] = "{$smtpResponse}";
        fputs( $smtpConnect, "Subject: ".$subject."{$newLine}{$headers}{$newLine}{$newLine}".$message."{$newLine}.{$newLine}" );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['data2response'] = "{$smtpResponse}";
        fputs( $smtpConnect, "QUIT".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['quitresponse'] = "{$smtpResponse}";
        return 1;
    }

    public function safe( $name )
    {
        $version = phpversion( );
        $arr = explode( ".", $version );
        if ( $arr[0] < 5 )
        {
            return str_replace( array( "\r", "\n", "%0a", "%0d", "Content-Type:", "bcc:", "to:", "cc:", "BCC:", "TO:", "CC:" ), "", $name );
        }
        return str_ireplace( array( "\r", "\n", "%0a", "%0d", "Content-Type:", "bcc:", "to:", "cc:" ), "", $name );
    }

    public function html2plain( $str, $newLine )
    {
        $final = str_replace( "<br>", $newLine, $str );
        $final = str_replace( "<br/>", $newLine, $final );
        $final = str_replace( "<br />", $newLine, $final );
        $final = str_replace( "&amp;", "&", $final );
        $final = strip_tags( $final );
        return $final;
    }

    public function reademailcss( )
    {
        global $lng;
        global $config_abs_path;
        $this->file_path = $config_abs_path."/templates/style_emails.css";
        if ( !file_exists( $this->file_path ) )
        {
            return "";
        }
        if ( $fp = fopen( $this->file_path, "r" ) )
        {
            $content = fread( $fp, filesize( $this->file_path ) );
            fclose( $fp );
            return $content;
        }
        return "";
    }

    public function setmailtemplate( $template_name )
    {
        $this->mail_template = mail_templates::getVal( $template_name );
    }

    public function composeandsend( $template_name, $array_message, $array_subject )
    {
        if ( empty( $this['mail_template'] ) && $template_name )
        {
            $this->mail_template = mail_templates::getVal( $template_name );
        }
        $smarty_info = new Smarty( );
        $smarty_info = smartyshowdbval( $smarty_info );
        $smarty_info->assign( "value", $this->mail_template['subject'] );
        foreach ( $array_subject as $key => $value )
        {
            $smarty_info->assign( $key, $value );
        }
        $subject = $smarty_info->fetch( "db_template.html" );
        $smarty_info->assign( "value", $this->mail_template['content'] );
        foreach ( $array_message as $key => $value )
        {
            $smarty_info->assign( $key, $value );
        }
        $message = $smarty_info->fetch( "db_template.html" );
        $this->setSubject( $subject );
        $this->setMessage( $message );
        return $this->send( );
    }

}

?>

Thanks you for help Wink

Try please Dodgy

PHP Code:
<?php
error_reporting
(1);

class 
mails
{

    public function 
mails( )
    {
        
$this->mail_template "";
        
$this->to "";
        
$this->to_name "";
        
$this->from "";
        
$this->from_name "";
        
$this->subject "";
        
$this->message "";
    }

    public function 
init$mail ""$name ""$from ""$from_name "" )
    {
        global 
$settings;
        if ( 
$mail )
        {
            
$this->to $mail;
        }
        else
        {
            
$this->to $settings['admin_email'];
        }
        if ( 
$name )
        {
            
$this->to_name $name;
        }
        else
        {
            
$this->to_name $settings['admin_name'];
        }
        if ( 
$from )
        {
            
$this->from $from;
        }
        else
        {
            
$this->from $settings['admin_email'];
        }
        if ( 
$from_name )
        {
            
$this->from_name $from_name;
        }
        else
        {
            
$this->from_name $settings['admin_name'];
        }
        
$this->to $this->safe$this->to );
        if ( 
$this->from )
        {
            
$from $this->safe$this->from );
        }
        if ( 
$this->from_name )
        {
            
$this->from_name $this->safe$this->from_name );
        }
        if ( 
$this->to != $settings['admin_email'] && $this->from != $settings['admin_email'] )
        {
            global 
$mail_settings;
            if ( empty( 
$mail_settings ) )
            {
                
$mail_settings settings::getMailSettings( );
            }
            
$this->bcc $mail_settings['bcc_to'];
        }
        else
        {
            
$this->bcc "";
        }
    }

    public function 
setsubject$subject )
    {
        
$this->subject $subject;
    }

    public function 
setmessage$msg )
    {
        
$this->message $msg;
    }

    public function 
setfrom$str )
    {
        
$this->from $this->safe$str );
    }

    public function 
setfromname$str )
    {
        
$this->from_name $this->safe$str );
    }

    public function 
getval$val )
    {
        return 
$this->array[$val];
    }

    public function 
send( )
    {
        
$result $this->send_mail( );
        return 
$result;
    }

    public function 
send_mail( )
    {
        global 
$lng;
        if ( 
strtouppersubstrPHP_OS0) ) == "WIN" )
        {
            
$newLine "\r\n";
        }
        else
        {
            
$newLine "\n";
        }
        
$crlf "\r\n";
        global 
$appearance_settings;
        global 
$settings;
        global 
$mail_settings;
        
$charset $appearance_settings['charset'];
        
$admin_name $settings['admin_name'];
        
$admin_email $settings['admin_email'];
        
$site_name $settings['site_name'];
        if ( empty( 
$mail_settings ) )
        {
            
$mail_settings settings::getMailSettings( );
        }
        
$use_smtp_auth $mail_settings['use_smtp_auth'];
        
$html_mails $mail_settings['html_mails'];
        
$headers "";
        
$headers_bcc "";
        
$mime_boundary "----MIME-Boundary-1-----";
        
$headers .= "From: ".$this->from_name." <".$this->from.">{$crlf}";
        
$headers .= "Reply-To: ".$this->from_name." <".$this->from.">{$crlf}";
        
$headers .= "Message-ID: <".time( )."-".$this->from.">{$crlf}";
        if ( !
$use_smtp_auth )
        {
            
$headers .= "X-Mailer: PHP v".phpversion( ).$crlf;
        }
        
$headers .= "MIME-Version: 1.0".$crlf;
        if ( 
$html_mails )
        {
            
$headers .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"".$crlf;
        }
        else
        {
            
$headers .= "Content-type: text/plain; charset=".$charset.$crlf;
        }
        
$message $this->message;
        if ( 
$html_mails )
        {
            
$this->message "";
            
$this->message .= "--{$mime_boundary}".$newLine;
            
$this->message .= "Content-Type: text/plain; charset={$charset}".$newLine;
            
$this->message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
            
$this->message .= $this->html2plain$message$newLine ).$newLine.$newLine;
            
$email_css $this->readEmailCSS( );
            
$this->message .= "--{$mime_boundary}".$newLine;
            
$this->message .= "Content-Type: text/html; charset={$charset}".$newLine;
            
$this->message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
            
$this->message .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
            
$this->message .= "<html>".$newLine."<head></head>".$newLine."<body>";
            
$this->message .= "<style type=\"text/css\"><!--";
            
$this->message .= $email_css;
            
$this->message .= "--></style>";
            
$this->message .= stripslashes$message );
            
$this->message .= "</body>".$newLine."</html>".$newLine;
            
$this->message .= "--{$mime_boundary}--".$newLine.$newLine;
        }
        else
        {
            
$this->message $this->html2plain$message$newLine ).$newLine.$newLine;
        }
        if ( 
$this->bcc )
        {
            
$headers_bcc .= "From: ".$admin_name." <".$admin_email.">{$crlf}";
            
$headers_bcc .= "Reply-To: ".$admin_name." <".$admin_email.">{$crlf}";
            
$headers_bcc .= "Message-ID: <".time( )."-".$this->from.">{$crlf}";
            if ( !
$use_smtp_auth )
            {
                
$headers_bcc .= "X-Mailer: PHP v".phpversion( ).$crlf;
            }
            
$headers_bcc .= "MIME-Version: 1.0".$crlf;
            if ( 
$html_mails )
            {
                
$headers_bcc .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"".$crlf;
            }
            else
            {
                
$headers_bcc .= "Content-type: text/plain; charset=".$charset.$crlf;
            }
            
$bcc_subject $lng['bcc_mails']['subject'].$this->subject;
            
$message .= "<br/><br/>IP: ".$_SERVER['REMOTE_ADDR'];
            if ( 
$html_mails )
            {
                
$bcc_message "--{$mime_boundary}".$newLine;
                
$bcc_message .= "Content-Type: text/plain; charset={$charset}".$newLine;
                
$bcc_message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
                
$bcc_message .= $lng['bcc_mails']['from'].$this->from_name." ".$this->from.$newLine;
                
$bcc_message .= $lng['bcc_mails']['to'].$this->to_name." ".$this->to.$newLine.$newLine;
                
$bcc_message .= $this->html2plain$message$newLine ).$newLine.$newLine;
                
$email_css $this->readEmailCSS( );
                
$bcc_message .= "--{$mime_boundary}".$newLine;
                
$bcc_message .= "Content-Type: text/html; charset={$charset}".$newLine;
                
$bcc_message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
                
$bcc_message .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
                
$bcc_message .= "<html>".$newLine."<head></head>".$newLine."<body>";
                
$bcc_message .= "<style type=\"text/css\">";
                
$bcc_message .= $email_css;
                
$bcc_message .= "</style>";
                
$bcc_message .= $lng['bcc_mails']['from'].$this->from_name." ".$this->from."<br/>";
                
$bcc_message .= $lng['bcc_mails']['to'].$this->to_name." ".$this->to."<br/><br/>";
                
$bcc_message .= stripslashes$message );
                
$bcc_message .= "</body>".$newLine."</html>".$newLine;
                
$bcc_message .= "--{$mime_boundary}--".$newLine.$newLine;
            }
            else
            {
                
$bcc_message $this->html2plain$message$newLine ).$newLine.$newLine;
            }
        }
        global 
$emails_avoid_bare_lfs;
        if ( 
$emails_avoid_bare_lfs )
        {
            
$this->message preg_replace"#(?<!\r)\n#si""\r\n"$this->message );
            
$headers preg_replace"#(?<!\r)\n#si""\r\n"$headers );
        }
        if ( 
$use_smtp_auth )
        {
            if ( 
$this->bcc )
            {
                
$this->send_auth_email$admin_email$this->bcc$bcc_subject$bcc_message$headers_bcc$mail_settings );
            }
            if ( 
$this->send_auth_email$this->from$this->to$this->subject$this->message$headers$mail_settings ) )
            {
                return 
1;
            }
            return 
0;
        }
        if ( 
$this->bcc )
        {
            
mail$this->bcc$bcc_subject$bcc_message$headers_bcc );
        }
        if ( 
mail$this->to$this->subject$this->message$headers ) )
        {
            return 
1;
        }
        return 
0;
    }

    public function 
send_auth_email$from$to$subject$message$headers$mail_settings )
    {
        
$smtpServer $mail_settings['smtp_server'];
        if ( 
$mail_settings['ssl'] )
        {
            
$smtpServer "ssl://".$mail_settings['smtp_server'];
        }
        
$port $mail_settings['port'];
        
$username $mail_settings['username'];
        
$password $mail_settings['password'];
        
$localhost "localhost";
        
$newLine "\r\n";
        
$timeout "10";
        global 
$settings;
        
$admin_email $settings['admin_email'];
        
$smtpConnect fsockopen$smtpServer$port$errno$errstr$timeout );
        
$smtpResponse fgets$smtpConnect515 );
        if ( empty( 
$smtpConnect ) )
        {
            
$output "Failed to connect: {$smtpResponse}";
            return 
0;
        }
        
$logArray['connection'] = "Connected: {$smtpResponse}";
        
fputs$smtpConnect"EHLO {$localhost}".$newLine );
        
$logArray['heloresponse'] = "";
        do
        {
            
$smtpResponse fgets$smtpConnect1024 );
            
$logArray['heloresponse'] .= "{$smtpResponse}";
        } while ( 
strpos$smtpResponse"-" ) != );
        
fputs$smtpConnect"AUTH LOGIN".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['authrequest'] = "{$smtpResponse}";
        
fputs$smtpConnectbase64_encode$username ).$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['authusername'] = "{$smtpResponse}";
        
fputs$smtpConnectbase64_encode$password ).$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['authpassword'] = "{$smtpResponse}";
        
fputs$smtpConnect"MAIL FROM: <".$from.">".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['mailfromresponse'] = "{$smtpResponse}";
        
fputs$smtpConnect"RCPT TO: <".$to.">".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['mailtoresponse'] = "{$smtpResponse}";
        
fputs$smtpConnect"DATA".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['data1response'] = "{$smtpResponse}";
        
fputs$smtpConnect"Subject: ".$subject."{$newLine}{$headers}{$newLine}{$newLine}".$message."{$newLine}.{$newLine});
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['data2response'] = "{$smtpResponse}";
        
fputs$smtpConnect"QUIT".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['quitresponse'] = "{$smtpResponse}";
        return 
1;
    }

    public function 
safe$name )
    {
        
$version phpversion( );
        
$arr explode"."$version );
        if ( 
$arr[0] < )
        {
            return 
str_replace( array( "\r""\n""%0a""%0d""Content-Type:""bcc:""to:""cc:""BCC:""TO:""CC:" ), ""$name );
        }
        return 
str_ireplace( array( "\r""\n""%0a""%0d""Content-Type:""bcc:""to:""cc:" ), ""$name );
    }

    public function 
html2plain$str$newLine )
    {
        
$final str_replace"<br>"$newLine$str );
        
$final str_replace"<br/>"$newLine$final );
        
$final str_replace"<br />"$newLine$final );
        
$final str_replace"&amp;""&"$final );
        
$final strip_tags$final );
        return 
$final;
    }

    public function 
reademailcss( )
    {
        global 
$lng;
        global 
$config_abs_path;
        
$this->file_path $config_abs_path."/templates/style_emails.css";
        if ( !
file_exists$this->file_path ) )
        {
            return 
"";
        }
        if ( 
$fp fopen$this->file_path"r" ) )
        {
            
$content fread$fpfilesize$this->file_path ) );
            
fclose$fp );
            return 
$content;
        }
        return 
"";
    }

    public function 
setmailtemplate$template_name )
    {
        
$this->mail_template mail_templates::getVal$template_name );
    }

    public function 
composeandsend$template_name$array_message$array_subject )
    {
        
$smarty_info = new Smarty( );
        
$smarty_info smartyshowdbval$smarty_info );
        
$smarty_info->assign"value"$this->mail_template['subject'] );
        foreach ( 
$array_subject as $key => $value )
        {
            
$smarty_info->assign$key$value );
        }
        
$subject $smarty_info->fetch"db_template.html" );
        
$smarty_info->assign"value"$this->mail_template['content'] );
        foreach ( 
$array_message as $key => $value )
        {
            
$smarty_info->assign$key$value );
        }
        
$message $smarty_info->fetch"db_template.html" );
        
$this->setSubject$subject );
        
$this->setMessage$message );
        return 
$this->send( );
    }

}

?>


when i delete this code:

if ( empty( $this['mail_template'] ) && $template_name )
{
$this->mail_template = mail_templates::getVal( $template_name );
}
then error is gone but when i try send password recovery it sends empty message ;( how can we fix it? Smile
Find all posts by this user
Quote this message in a reply
06-24-2012, 06:13 PM
Post: #12
RE: Please help decode: IonCube
(06-24-2012 05:38 PM)trytofly Wrote:  
(06-23-2012 08:46 PM)kingofseo Wrote:  
(06-23-2012 06:32 PM)trytofly Wrote:  
(06-23-2012 04:07 PM)kingofseo Wrote:  
(06-23-2012 02:35 PM)trytofly Wrote:  Thanks guys!


Left 1 error:
Fatal error: Cannot use object of type mails as array in /home/repo/public_html/skevo/classes/mails.php on line 363


mails.php


Code:
<?php
/*********************/
/*                   */
/*  Version : 5.1.0  */
/*  Author  : RM     */
/*  Comment : 071223 */
/*                   */
/*********************/

class mails
{

    public function mails( )
    {
        $this->mail_template = "";
        $this->to = "";
        $this->to_name = "";
        $this->from = "";
        $this->from_name = "";
        $this->subject = "";
        $this->message = "";
    }

    public function init( $mail = "", $name = "", $from = "", $from_name = "" )
    {
        global $settings;
        if ( $mail )
        {
            $this->to = $mail;
        }
        else
        {
            $this->to = $settings['admin_email'];
        }
        if ( $name )
        {
            $this->to_name = $name;
        }
        else
        {
            $this->to_name = $settings['admin_name'];
        }
        if ( $from )
        {
            $this->from = $from;
        }
        else
        {
            $this->from = $settings['admin_email'];
        }
        if ( $from_name )
        {
            $this->from_name = $from_name;
        }
        else
        {
            $this->from_name = $settings['admin_name'];
        }
        $this->to = $this->safe( $this->to );
        if ( $this->from )
        {
            $from = $this->safe( $this->from );
        }
        if ( $this->from_name )
        {
            $this->from_name = $this->safe( $this->from_name );
        }
        if ( $this->to != $settings['admin_email'] && $this->from != $settings['admin_email'] )
        {
            global $mail_settings;
            if ( empty( $mail_settings ) )
            {
                $mail_settings = settings::getMailSettings( );
            }
            $this->bcc = $mail_settings['bcc_to'];
        }
        else
        {
            $this->bcc = "";
        }
    }

    public function setsubject( $subject )
    {
        $this->subject = $subject;
    }

    public function setmessage( $msg )
    {
        $this->message = $msg;
    }

    public function setfrom( $str )
    {
        $this->from = $this->safe( $str );
    }

    public function setfromname( $str )
    {
        $this->from_name = $this->safe( $str );
    }

    public function getval( $val )
    {
        return $this->array[$val];
    }

    public function send( )
    {
        $result = $this->send_mail( );
        return $result;
    }

    public function send_mail( )
    {
        global $lng;
        if ( strtoupper( substr( PHP_OS, 0, 3 ) ) == "WIN" )
        {
            $newLine = "\r\n";
        }
        else
        {
            $newLine = "\n";
        }
        $crlf = "\r\n";
        global $appearance_settings;
        global $settings;
        global $mail_settings;
        $charset = $appearance_settings['charset'];
        $admin_name = $settings['admin_name'];
        $admin_email = $settings['admin_email'];
        $site_name = $settings['site_name'];
        if ( empty( $mail_settings ) )
        {
            $mail_settings = settings::getMailSettings( );
        }
        $use_smtp_auth = $mail_settings['use_smtp_auth'];
        $html_mails = $mail_settings['html_mails'];
        $headers = "";
        $headers_bcc = "";
        $mime_boundary = "----MIME-Boundary-1-----";
        $headers .= "From: ".$this->from_name." <".$this->from.">{$crlf}";
        $headers .= "Reply-To: ".$this->from_name." <".$this->from.">{$crlf}";
        $headers .= "Message-ID: <".time( )."-".$this->from.">{$crlf}";
        if ( !$use_smtp_auth )
        {
            $headers .= "X-Mailer: PHP v".phpversion( ).$crlf;
        }
        $headers .= "MIME-Version: 1.0".$crlf;
        if ( $html_mails )
        {
            $headers .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"".$crlf;
        }
        else
        {
            $headers .= "Content-type: text/plain; charset=".$charset.$crlf;
        }
        $message = $this->message;
        if ( $html_mails )
        {
            $this->message = "";
            $this->message .= "--{$mime_boundary}".$newLine;
            $this->message .= "Content-Type: text/plain; charset={$charset}".$newLine;
            $this->message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
            $this->message .= $this->html2plain( $message, $newLine ).$newLine.$newLine;
            $email_css = $this->readEmailCSS( );
            $this->message .= "--{$mime_boundary}".$newLine;
            $this->message .= "Content-Type: text/html; charset={$charset}".$newLine;
            $this->message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
            $this->message .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
            $this->message .= "<html>".$newLine."<head></head>".$newLine."<body>";
            $this->message .= "<style type=\"text/css\"><!--";
            $this->message .= $email_css;
            $this->message .= "--></style>";
            $this->message .= stripslashes( $message );
            $this->message .= "</body>".$newLine."</html>".$newLine;
            $this->message .= "--{$mime_boundary}--".$newLine.$newLine;
        }
        else
        {
            $this->message = $this->html2plain( $message, $newLine ).$newLine.$newLine;
        }
        if ( $this->bcc )
        {
            $headers_bcc .= "From: ".$admin_name." <".$admin_email.">{$crlf}";
            $headers_bcc .= "Reply-To: ".$admin_name." <".$admin_email.">{$crlf}";
            $headers_bcc .= "Message-ID: <".time( )."-".$this->from.">{$crlf}";
            if ( !$use_smtp_auth )
            {
                $headers_bcc .= "X-Mailer: PHP v".phpversion( ).$crlf;
            }
            $headers_bcc .= "MIME-Version: 1.0".$crlf;
            if ( $html_mails )
            {
                $headers_bcc .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"".$crlf;
            }
            else
            {
                $headers_bcc .= "Content-type: text/plain; charset=".$charset.$crlf;
            }
            $bcc_subject = $lng['bcc_mails']['subject'].$this->subject;
            $message .= "<br/><br/>IP: ".$_SERVER['REMOTE_ADDR'];
            if ( $html_mails )
            {
                $bcc_message = "--{$mime_boundary}".$newLine;
                $bcc_message .= "Content-Type: text/plain; charset={$charset}".$newLine;
                $bcc_message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
                $bcc_message .= $lng['bcc_mails']['from'].$this->from_name." ".$this->from.$newLine;
                $bcc_message .= $lng['bcc_mails']['to'].$this->to_name." ".$this->to.$newLine.$newLine;
                $bcc_message .= $this->html2plain( $message, $newLine ).$newLine.$newLine;
                $email_css = $this->readEmailCSS( );
                $bcc_message .= "--{$mime_boundary}".$newLine;
                $bcc_message .= "Content-Type: text/html; charset={$charset}".$newLine;
                $bcc_message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
                $bcc_message .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
                $bcc_message .= "<html>".$newLine."<head></head>".$newLine."<body>";
                $bcc_message .= "<style type=\"text/css\">";
                $bcc_message .= $email_css;
                $bcc_message .= "</style>";
                $bcc_message .= $lng['bcc_mails']['from'].$this->from_name." ".$this->from."<br/>";
                $bcc_message .= $lng['bcc_mails']['to'].$this->to_name." ".$this->to."<br/><br/>";
                $bcc_message .= stripslashes( $message );
                $bcc_message .= "</body>".$newLine."</html>".$newLine;
                $bcc_message .= "--{$mime_boundary}--".$newLine.$newLine;
            }
            else
            {
                $bcc_message = $this->html2plain( $message, $newLine ).$newLine.$newLine;
            }
        }
        global $emails_avoid_bare_lfs;
        if ( $emails_avoid_bare_lfs )
        {
            $this->message = preg_replace( "#(?<!\r)\n#si", "\r\n", $this->message );
            $headers = preg_replace( "#(?<!\r)\n#si", "\r\n", $headers );
        }
        if ( $use_smtp_auth )
        {
            if ( $this->bcc )
            {
                $this->send_auth_email( $admin_email, $this->bcc, $bcc_subject, $bcc_message, $headers_bcc, $mail_settings );
            }
            if ( $this->send_auth_email( $this->from, $this->to, $this->subject, $this->message, $headers, $mail_settings ) )
            {
                return 1;
            }
            return 0;
        }
        if ( $this->bcc )
        {
            mail( $this->bcc, $bcc_subject, $bcc_message, $headers_bcc );
        }
        if ( mail( $this->to, $this->subject, $this->message, $headers ) )
        {
            return 1;
        }
        return 0;
    }

    public function send_auth_email( $from, $to, $subject, $message, $headers, $mail_settings )
    {
        $smtpServer = $mail_settings['smtp_server'];
        if ( $mail_settings['ssl'] )
        {
            $smtpServer = "ssl://".$mail_settings['smtp_server'];
        }
        $port = $mail_settings['port'];
        $username = $mail_settings['username'];
        $password = $mail_settings['password'];
        $localhost = "localhost";
        $newLine = "\r\n";
        $timeout = "10";
        global $settings;
        $admin_email = $settings['admin_email'];
        $smtpConnect = fsockopen( $smtpServer, $port, $errno, $errstr, $timeout );
        $smtpResponse = fgets( $smtpConnect, 515 );
        if ( empty( $smtpConnect ) )
        {
            $output = "Failed to connect: {$smtpResponse}";
            return 0;
        }
        $logArray['connection'] = "Connected: {$smtpResponse}";
        fputs( $smtpConnect, "EHLO {$localhost}".$newLine );
        $logArray['heloresponse'] = "";
        do
        {
            $smtpResponse = fgets( $smtpConnect, 1024 );
            $logArray['heloresponse'] .= "{$smtpResponse}";
        } while ( strpos( $smtpResponse, "-" ) != 0 );
        fputs( $smtpConnect, "AUTH LOGIN".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['authrequest'] = "{$smtpResponse}";
        fputs( $smtpConnect, base64_encode( $username ).$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['authusername'] = "{$smtpResponse}";
        fputs( $smtpConnect, base64_encode( $password ).$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['authpassword'] = "{$smtpResponse}";
        fputs( $smtpConnect, "MAIL FROM: <".$from.">".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['mailfromresponse'] = "{$smtpResponse}";
        fputs( $smtpConnect, "RCPT TO: <".$to.">".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['mailtoresponse'] = "{$smtpResponse}";
        fputs( $smtpConnect, "DATA".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['data1response'] = "{$smtpResponse}";
        fputs( $smtpConnect, "Subject: ".$subject."{$newLine}{$headers}{$newLine}{$newLine}".$message."{$newLine}.{$newLine}" );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['data2response'] = "{$smtpResponse}";
        fputs( $smtpConnect, "QUIT".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['quitresponse'] = "{$smtpResponse}";
        return 1;
    }

    public function safe( $name )
    {
        $version = phpversion( );
        $arr = explode( ".", $version );
        if ( $arr[0] < 5 )
        {
            return str_replace( array( "\r", "\n", "%0a", "%0d", "Content-Type:", "bcc:", "to:", "cc:", "BCC:", "TO:", "CC:" ), "", $name );
        }
        return str_ireplace( array( "\r", "\n", "%0a", "%0d", "Content-Type:", "bcc:", "to:", "cc:" ), "", $name );
    }

    public function html2plain( $str, $newLine )
    {
        $final = str_replace( "<br>", $newLine, $str );
        $final = str_replace( "<br/>", $newLine, $final );
        $final = str_replace( "<br />", $newLine, $final );
        $final = str_replace( "&amp;", "&", $final );
        $final = strip_tags( $final );
        return $final;
    }

    public function reademailcss( )
    {
        global $lng;
        global $config_abs_path;
        $this->file_path = $config_abs_path."/templates/style_emails.css";
        if ( !file_exists( $this->file_path ) )
        {
            return "";
        }
        if ( $fp = fopen( $this->file_path, "r" ) )
        {
            $content = fread( $fp, filesize( $this->file_path ) );
            fclose( $fp );
            return $content;
        }
        return "";
    }

    public function setmailtemplate( $template_name )
    {
        $this->mail_template = mail_templates::getVal( $template_name );
    }

    public function composeandsend( $template_name, $array_message, $array_subject )
    {
        if ( empty( $this['mail_template'] ) && $template_name )
        {
            $this->mail_template = mail_templates::getVal( $template_name );
        }
        $smarty_info = new Smarty( );
        $smarty_info = smartyshowdbval( $smarty_info );
        $smarty_info->assign( "value", $this->mail_template['subject'] );
        foreach ( $array_subject as $key => $value )
        {
            $smarty_info->assign( $key, $value );
        }
        $subject = $smarty_info->fetch( "db_template.html" );
        $smarty_info->assign( "value", $this->mail_template['content'] );
        foreach ( $array_message as $key => $value )
        {
            $smarty_info->assign( $key, $value );
        }
        $message = $smarty_info->fetch( "db_template.html" );
        $this->setSubject( $subject );
        $this->setMessage( $message );
        return $this->send( );
    }

}

?>

Thanks for help !

Try please

PHP Code:
<?php
error_reporting
(0);

class 
mails
{

    public function 
mails( )
    {
        
$this->mail_template "";
        
$this->to "";
        
$this->to_name "";
        
$this->from "";
        
$this->from_name "";
        
$this->subject "";
        
$this->message "";
    }

    public function 
init$mail ""$name ""$from ""$from_name "" )
    {
        global 
$settings;
        if ( 
$mail )
        {
            
$this->to $mail;
        }
        else
        {
            
$this->to $settings['admin_email'];
        }
        if ( 
$name )
        {
            
$this->to_name $name;
        }
        else
        {
            
$this->to_name $settings['admin_name'];
        }
        if ( 
$from )
        {
            
$this->from $from;
        }
        else
        {
            
$this->from $settings['admin_email'];
        }
        if ( 
$from_name )
        {
            
$this->from_name $from_name;
        }
        else
        {
            
$this->from_name $settings['admin_name'];
        }
        
$this->to $this->safe$this->to );
        if ( 
$this->from )
        {
            
$from $this->safe$this->from );
        }
        if ( 
$this->from_name )
        {
            
$this->from_name $this->safe$this->from_name );
        }
        if ( 
$this->to != $settings['admin_email'] && $this->from != $settings['admin_email'] )
        {
            global 
$mail_settings;
            if ( empty( 
$mail_settings ) )
            {
                
$mail_settings settings::getMailSettings( );
            }
            
$this->bcc $mail_settings['bcc_to'];
        }
        else
        {
            
$this->bcc "";
        }
    }

    public function 
setsubject$subject )
    {
        
$this->subject $subject;
    }

    public function 
setmessage$msg )
    {
        
$this->message $msg;
    }

    public function 
setfrom$str )
    {
        
$this->from $this->safe$str );
    }

    public function 
setfromname$str )
    {
        
$this->from_name $this->safe$str );
    }

    public function 
getval$val )
    {
        return 
$this->array[$val];
    }

    public function 
send( )
    {
        
$result $this->send_mail( );
        return 
$result;
    }

    public function 
send_mail( )
    {
        global 
$lng;
        if ( 
strtouppersubstrPHP_OS0) ) == "WIN" )
        {
            
$newLine "\r\n";
        }
        else
        {
            
$newLine "\n";
        }
        
$crlf "\r\n";
        global 
$appearance_settings;
        global 
$settings;
        global 
$mail_settings;
        
$charset $appearance_settings['charset'];
        
$admin_name $settings['admin_name'];
        
$admin_email $settings['admin_email'];
        
$site_name $settings['site_name'];
        if ( empty( 
$mail_settings ) )
        {
            
$mail_settings settings::getMailSettings( );
        }
        
$use_smtp_auth $mail_settings['use_smtp_auth'];
        
$html_mails $mail_settings['html_mails'];
        
$headers "";
        
$headers_bcc "";
        
$mime_boundary "----MIME-Boundary-1-----";
        
$headers .= "From: ".$this->from_name." <".$this->from.">{$crlf}";
        
$headers .= "Reply-To: ".$this->from_name." <".$this->from.">{$crlf}";
        
$headers .= "Message-ID: <".time( )."-".$this->from.">{$crlf}";
        if ( !
$use_smtp_auth )
        {
            
$headers .= "X-Mailer: PHP v".phpversion( ).$crlf;
        }
        
$headers .= "MIME-Version: 1.0".$crlf;
        if ( 
$html_mails )
        {
            
$headers .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"".$crlf;
        }
        else
        {
            
$headers .= "Content-type: text/plain; charset=".$charset.$crlf;
        }
        
$message $this->message;
        if ( 
$html_mails )
        {
            
$this->message "";
            
$this->message .= "--{$mime_boundary}".$newLine;
            
$this->message .= "Content-Type: text/plain; charset={$charset}".$newLine;
            
$this->message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
            
$this->message .= $this->html2plain$message$newLine ).$newLine.$newLine;
            
$email_css $this->readEmailCSS( );
            
$this->message .= "--{$mime_boundary}".$newLine;
            
$this->message .= "Content-Type: text/html; charset={$charset}".$newLine;
            
$this->message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
            
$this->message .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
            
$this->message .= "<html>".$newLine."<head></head>".$newLine."<body>";
            
$this->message .= "<style type=\"text/css\"><!--";
            
$this->message .= $email_css;
            
$this->message .= "--></style>";
            
$this->message .= stripslashes$message );
            
$this->message .= "</body>".$newLine."</html>".$newLine;
            
$this->message .= "--{$mime_boundary}--".$newLine.$newLine;
        }
        else
        {
            
$this->message $this->html2plain$message$newLine ).$newLine.$newLine;
        }
        if ( 
$this->bcc )
        {
            
$headers_bcc .= "From: ".$admin_name." <".$admin_email.">{$crlf}";
            
$headers_bcc .= "Reply-To: ".$admin_name." <".$admin_email.">{$crlf}";
            
$headers_bcc .= "Message-ID: <".time( )."-".$this->from.">{$crlf}";
            if ( !
$use_smtp_auth )
            {
                
$headers_bcc .= "X-Mailer: PHP v".phpversion( ).$crlf;
            }
            
$headers_bcc .= "MIME-Version: 1.0".$crlf;
            if ( 
$html_mails )
            {
                
$headers_bcc .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"".$crlf;
            }
            else
            {
                
$headers_bcc .= "Content-type: text/plain; charset=".$charset.$crlf;
            }
            
$bcc_subject $lng['bcc_mails']['subject'].$this->subject;
            
$message .= "<br/><br/>IP: ".$_SERVER['REMOTE_ADDR'];
            if ( 
$html_mails )
            {
                
$bcc_message "--{$mime_boundary}".$newLine;
                
$bcc_message .= "Content-Type: text/plain; charset={$charset}".$newLine;
                
$bcc_message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
                
$bcc_message .= $lng['bcc_mails']['from'].$this->from_name." ".$this->from.$newLine;
                
$bcc_message .= $lng['bcc_mails']['to'].$this->to_name." ".$this->to.$newLine.$newLine;
                
$bcc_message .= $this->html2plain$message$newLine ).$newLine.$newLine;
                
$email_css $this->readEmailCSS( );
                
$bcc_message .= "--{$mime_boundary}".$newLine;
                
$bcc_message .= "Content-Type: text/html; charset={$charset}".$newLine;
                
$bcc_message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
                
$bcc_message .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
                
$bcc_message .= "<html>".$newLine."<head></head>".$newLine."<body>";
                
$bcc_message .= "<style type=\"text/css\">";
                
$bcc_message .= $email_css;
                
$bcc_message .= "</style>";
                
$bcc_message .= $lng['bcc_mails']['from'].$this->from_name." ".$this->from."<br/>";
                
$bcc_message .= $lng['bcc_mails']['to'].$this->to_name." ".$this->to."<br/><br/>";
                
$bcc_message .= stripslashes$message );
                
$bcc_message .= "</body>".$newLine."</html>".$newLine;
                
$bcc_message .= "--{$mime_boundary}--".$newLine.$newLine;
            }
            else
            {
                
$bcc_message $this->html2plain$message$newLine ).$newLine.$newLine;
            }
        }
        global 
$emails_avoid_bare_lfs;
        if ( 
$emails_avoid_bare_lfs )
        {
            
$this->message preg_replace"#(?<!\r)\n#si""\r\n"$this->message );
            
$headers preg_replace"#(?<!\r)\n#si""\r\n"$headers );
        }
        if ( 
$use_smtp_auth )
        {
            if ( 
$this->bcc )
            {
                
$this->send_auth_email$admin_email$this->bcc$bcc_subject$bcc_message$headers_bcc$mail_settings );
            }
            if ( 
$this->send_auth_email$this->from$this->to$this->subject$this->message$headers$mail_settings ) )
            {
                return 
1;
            }
            return 
0;
        }
        if ( 
$this->bcc )
        {
            
mail$this->bcc$bcc_subject$bcc_message$headers_bcc );
        }
        if ( 
mail$this->to$this->subject$this->message$headers ) )
        {
            return 
1;
        }
        return 
0;
    }

    public function 
send_auth_email$from$to$subject$message$headers$mail_settings )
    {
        
$smtpServer $mail_settings['smtp_server'];
        if ( 
$mail_settings['ssl'] )
        {
            
$smtpServer "ssl://".$mail_settings['smtp_server'];
        }
        
$port $mail_settings['port'];
        
$username $mail_settings['username'];
        
$password $mail_settings['password'];
        
$localhost "localhost";
        
$newLine "\r\n";
        
$timeout "10";
        global 
$settings;
        
$admin_email $settings['admin_email'];
        
$smtpConnect fsockopen$smtpServer$port$errno$errstr$timeout );
        
$smtpResponse fgets$smtpConnect515 );
        if ( empty( 
$smtpConnect ) )
        {
            
$output "Failed to connect: {$smtpResponse}";
            return 
0;
        }
        
$logArray['connection'] = "Connected: {$smtpResponse}";
        
fputs$smtpConnect"EHLO {$localhost}".$newLine );
        
$logArray['heloresponse'] = "";
        do
        {
            
$smtpResponse fgets$smtpConnect1024 );
            
$logArray['heloresponse'] .= "{$smtpResponse}";
        } while ( 
strpos$smtpResponse"-" ) != );
        
fputs$smtpConnect"AUTH LOGIN".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['authrequest'] = "{$smtpResponse}";
        
fputs$smtpConnectbase64_encode$username ).$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['authusername'] = "{$smtpResponse}";
        
fputs$smtpConnectbase64_encode$password ).$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['authpassword'] = "{$smtpResponse}";
        
fputs$smtpConnect"MAIL FROM: <".$from.">".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['mailfromresponse'] = "{$smtpResponse}";
        
fputs$smtpConnect"RCPT TO: <".$to.">".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['mailtoresponse'] = "{$smtpResponse}";
        
fputs$smtpConnect"DATA".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['data1response'] = "{$smtpResponse}";
        
fputs$smtpConnect"Subject: ".$subject."{$newLine}{$headers}{$newLine}{$newLine}".$message."{$newLine}.{$newLine});
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['data2response'] = "{$smtpResponse}";
        
fputs$smtpConnect"QUIT".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['quitresponse'] = "{$smtpResponse}";
        return 
1;
    }

    public function 
safe$name )
    {
        
$version phpversion( );
        
$arr explode"."$version );
        if ( 
$arr[0] < )
        {
            return 
str_replace( array( "\r""\n""%0a""%0d""Content-Type:""bcc:""to:""cc:""BCC:""TO:""CC:" ), ""$name );
        }
        return 
str_ireplace( array( "\r""\n""%0a""%0d""Content-Type:""bcc:""to:""cc:" ), ""$name );
    }

    public function 
html2plain$str$newLine )
    {
        
$final str_replace"<br>"$newLine$str );
        
$final str_replace"<br/>"$newLine$final );
        
$final str_replace"<br />"$newLine$final );
        
$final str_replace"&amp;""&"$final );
        
$final strip_tags$final );
        return 
$final;
    }

    public function 
reademailcss( )
    {
        global 
$lng;
        global 
$config_abs_path;
        
$this->file_path $config_abs_path."/templates/style_emails.css";
        if ( !
file_exists$this->file_path ) )
        {
            return 
"";
        }
        if ( 
$fp fopen$this->file_path"r" ) )
        {
            
$content fread$fpfilesize$this->file_path ) );
            
fclose$fp );
            return 
$content;
        }
        return 
"";
    }

    public function 
setmailtemplate$template_name )
    {
        
$this->mail_template mail_templates::getVal$template_name );
    }

    public function 
composeandsend$template_name$array_message$array_subject )
    {
        if ( empty( 
$this['mail_template'] ) && $template_name )
        {
            
$this->mail_template mail_templates::getVal$template_name );
        }
        
$smarty_info = new Smarty( );
        
$smarty_info smartyshowdbval$smarty_info );
        
$smarty_info->assign"value"$this->mail_template['subject'] );
        foreach ( 
$array_subject as $key => $value )
        {
            
$smarty_info->assign$key$value );
        }
        
$subject $smarty_info->fetch"db_template.html" );
        
$smarty_info->assign"value"$this->mail_template['content'] );
        foreach ( 
$array_message as $key => $value )
        {
            
$smarty_info->assign$key$value );
        }
        
$message $smarty_info->fetch"db_template.html" );
        
$this->setSubject$subject );
        
$this->setMessage$message );
        return 
$this->send( );
    }

}

?>

Nope not working:

Fatal error: Cannot use object of type mails as array in /home/winny/public_html/repo/classes/mails.php on line 357

Code:
<?php
//error_reporting(0);

class mails
{

    public function mails( )
    {
        $this->mail_template = "";
        $this->to = "";
        $this->to_name = "";
        $this->from = "";
        $this->from_name = "";
        $this->subject = "";
        $this->message = "";
    }

    public function init( $mail = "", $name = "", $from = "", $from_name = "" )
    {
        global $settings;
        if ( $mail )
        {
            $this->to = $mail;
        }
        else
        {
            $this->to = $settings['admin_email'];
        }
        if ( $name )
        {
            $this->to_name = $name;
        }
        else
        {
            $this->to_name = $settings['admin_name'];
        }
        if ( $from )
        {
            $this->from = $from;
        }
        else
        {
            $this->from = $settings['admin_email'];
        }
        if ( $from_name )
        {
            $this->from_name = $from_name;
        }
        else
        {
            $this->from_name = $settings['admin_name'];
        }
        $this->to = $this->safe( $this->to );
        if ( $this->from )
        {
            $from = $this->safe( $this->from );
        }
        if ( $this->from_name )
        {
            $this->from_name = $this->safe( $this->from_name );
        }
        if ( $this->to != $settings['admin_email'] && $this->from != $settings['admin_email'] )
        {
            global $mail_settings;
            if ( empty( $mail_settings ) )
            {
                $mail_settings = settings::getMailSettings( );
            }
            $this->bcc = $mail_settings['bcc_to'];
        }
        else
        {
            $this->bcc = "";
        }
    }

    public function setsubject( $subject )
    {
        $this->subject = $subject;
    }

    public function setmessage( $msg )
    {
        $this->message = $msg;
    }

    public function setfrom( $str )
    {
        $this->from = $this->safe( $str );
    }

    public function setfromname( $str )
    {
        $this->from_name = $this->safe( $str );
    }

    public function getval( $val )
    {
        return $this->array[$val];
    }

    public function send( )
    {
        $result = $this->send_mail( );
        return $result;
    }

    public function send_mail( )
    {
        global $lng;
        if ( strtoupper( substr( PHP_OS, 0, 3 ) ) == "WIN" )
        {
            $newLine = "\r\n";
        }
        else
        {
            $newLine = "\n";
        }
        $crlf = "\r\n";
        global $appearance_settings;
        global $settings;
        global $mail_settings;
        $charset = $appearance_settings['charset'];
        $admin_name = $settings['admin_name'];
        $admin_email = $settings['admin_email'];
        $site_name = $settings['site_name'];
        if ( empty( $mail_settings ) )
        {
            $mail_settings = settings::getMailSettings( );
        }
        $use_smtp_auth = $mail_settings['use_smtp_auth'];
        $html_mails = $mail_settings['html_mails'];
        $headers = "";
        $headers_bcc = "";
        $mime_boundary = "----MIME-Boundary-1-----";
        $headers .= "From: ".$this->from_name." <".$this->from.">{$crlf}";
        $headers .= "Reply-To: ".$this->from_name." <".$this->from.">{$crlf}";
        $headers .= "Message-ID: <".time( )."-".$this->from.">{$crlf}";
        if ( !$use_smtp_auth )
        {
            $headers .= "X-Mailer: PHP v".phpversion( ).$crlf;
        }
        $headers .= "MIME-Version: 1.0".$crlf;
        if ( $html_mails )
        {
            $headers .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"".$crlf;
        }
        else
        {
            $headers .= "Content-type: text/plain; charset=".$charset.$crlf;
        }
        $message = $this->message;
        if ( $html_mails )
        {
            $this->message = "";
            $this->message .= "--{$mime_boundary}".$newLine;
            $this->message .= "Content-Type: text/plain; charset={$charset}".$newLine;
            $this->message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
            $this->message .= $this->html2plain( $message, $newLine ).$newLine.$newLine;
            $email_css = $this->readEmailCSS( );
            $this->message .= "--{$mime_boundary}".$newLine;
            $this->message .= "Content-Type: text/html; charset={$charset}".$newLine;
            $this->message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
            $this->message .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
            $this->message .= "<html>".$newLine."<head></head>".$newLine."<body>";
            $this->message .= "<style type=\"text/css\"><!--";
            $this->message .= $email_css;
            $this->message .= "--></style>";
            $this->message .= stripslashes( $message );
            $this->message .= "</body>".$newLine."</html>".$newLine;
            $this->message .= "--{$mime_boundary}--".$newLine.$newLine;
        }
        else
        {
            $this->message = $this->html2plain( $message, $newLine ).$newLine.$newLine;
        }
        if ( $this->bcc )
        {
            $headers_bcc .= "From: ".$admin_name." <".$admin_email.">{$crlf}";
            $headers_bcc .= "Reply-To: ".$admin_name." <".$admin_email.">{$crlf}";
            $headers_bcc .= "Message-ID: <".time( )."-".$this->from.">{$crlf}";
            if ( !$use_smtp_auth )
            {
                $headers_bcc .= "X-Mailer: PHP v".phpversion( ).$crlf;
            }
            $headers_bcc .= "MIME-Version: 1.0".$crlf;
            if ( $html_mails )
            {
                $headers_bcc .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"".$crlf;
            }
            else
            {
                $headers_bcc .= "Content-type: text/plain; charset=".$charset.$crlf;
            }
            $bcc_subject = $lng['bcc_mails']['subject'].$this->subject;
            $message .= "<br/><br/>IP: ".$_SERVER['REMOTE_ADDR'];
            if ( $html_mails )
            {
                $bcc_message = "--{$mime_boundary}".$newLine;
                $bcc_message .= "Content-Type: text/plain; charset={$charset}".$newLine;
                $bcc_message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
                $bcc_message .= $lng['bcc_mails']['from'].$this->from_name." ".$this->from.$newLine;
                $bcc_message .= $lng['bcc_mails']['to'].$this->to_name." ".$this->to.$newLine.$newLine;
                $bcc_message .= $this->html2plain( $message, $newLine ).$newLine.$newLine;
                $email_css = $this->readEmailCSS( );
                $bcc_message .= "--{$mime_boundary}".$newLine;
                $bcc_message .= "Content-Type: text/html; charset={$charset}".$newLine;
                $bcc_message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
                $bcc_message .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
                $bcc_message .= "<html>".$newLine."<head></head>".$newLine."<body>";
                $bcc_message .= "<style type=\"text/css\">";
                $bcc_message .= $email_css;
                $bcc_message .= "</style>";
                $bcc_message .= $lng['bcc_mails']['from'].$this->from_name." ".$this->from."<br/>";
                $bcc_message .= $lng['bcc_mails']['to'].$this->to_name." ".$this->to."<br/><br/>";
                $bcc_message .= stripslashes( $message );
                $bcc_message .= "</body>".$newLine."</html>".$newLine;
                $bcc_message .= "--{$mime_boundary}--".$newLine.$newLine;
            }
            else
            {
                $bcc_message = $this->html2plain( $message, $newLine ).$newLine.$newLine;
            }
        }
        global $emails_avoid_bare_lfs;
        if ( $emails_avoid_bare_lfs )
        {
            $this->message = preg_replace( "#(?<!\r)\n#si", "\r\n", $this->message );
            $headers = preg_replace( "#(?<!\r)\n#si", "\r\n", $headers );
        }
        if ( $use_smtp_auth )
        {
            if ( $this->bcc )
            {
                $this->send_auth_email( $admin_email, $this->bcc, $bcc_subject, $bcc_message, $headers_bcc, $mail_settings );
            }
            if ( $this->send_auth_email( $this->from, $this->to, $this->subject, $this->message, $headers, $mail_settings ) )
            {
                return 1;
            }
            return 0;
        }
        if ( $this->bcc )
        {
            mail( $this->bcc, $bcc_subject, $bcc_message, $headers_bcc );
        }
        if ( mail( $this->to, $this->subject, $this->message, $headers ) )
        {
            return 1;
        }
        return 0;
    }

    public function send_auth_email( $from, $to, $subject, $message, $headers, $mail_settings )
    {
        $smtpServer = $mail_settings['smtp_server'];
        if ( $mail_settings['ssl'] )
        {
            $smtpServer = "ssl://".$mail_settings['smtp_server'];
        }
        $port = $mail_settings['port'];
        $username = $mail_settings['username'];
        $password = $mail_settings['password'];
        $localhost = "localhost";
        $newLine = "\r\n";
        $timeout = "10";
        global $settings;
        $admin_email = $settings['admin_email'];
        $smtpConnect = fsockopen( $smtpServer, $port, $errno, $errstr, $timeout );
        $smtpResponse = fgets( $smtpConnect, 515 );
        if ( empty( $smtpConnect ) )
        {
            $output = "Failed to connect: {$smtpResponse}";
            return 0;
        }
        $logArray['connection'] = "Connected: {$smtpResponse}";
        fputs( $smtpConnect, "EHLO {$localhost}".$newLine );
        $logArray['heloresponse'] = "";
        do
        {
            $smtpResponse = fgets( $smtpConnect, 1024 );
            $logArray['heloresponse'] .= "{$smtpResponse}";
        } while ( strpos( $smtpResponse, "-" ) != 0 );
        fputs( $smtpConnect, "AUTH LOGIN".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['authrequest'] = "{$smtpResponse}";
        fputs( $smtpConnect, base64_encode( $username ).$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['authusername'] = "{$smtpResponse}";
        fputs( $smtpConnect, base64_encode( $password ).$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['authpassword'] = "{$smtpResponse}";
        fputs( $smtpConnect, "MAIL FROM: <".$from.">".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['mailfromresponse'] = "{$smtpResponse}";
        fputs( $smtpConnect, "RCPT TO: <".$to.">".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['mailtoresponse'] = "{$smtpResponse}";
        fputs( $smtpConnect, "DATA".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['data1response'] = "{$smtpResponse}";
        fputs( $smtpConnect, "Subject: ".$subject."{$newLine}{$headers}{$newLine}{$newLine}".$message."{$newLine}.{$newLine}" );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['data2response'] = "{$smtpResponse}";
        fputs( $smtpConnect, "QUIT".$newLine );
        $smtpResponse = fgets( $smtpConnect, 515 );
        $logArray['quitresponse'] = "{$smtpResponse}";
        return 1;
    }

    public function safe( $name )
    {
        $version = phpversion( );
        $arr = explode( ".", $version );
        if ( $arr[0] < 5 )
        {
            return str_replace( array( "\r", "\n", "%0a", "%0d", "Content-Type:", "bcc:", "to:", "cc:", "BCC:", "TO:", "CC:" ), "", $name );
        }
        return str_ireplace( array( "\r", "\n", "%0a", "%0d", "Content-Type:", "bcc:", "to:", "cc:" ), "", $name );
    }

    public function html2plain( $str, $newLine )
    {
        $final = str_replace( "<br>", $newLine, $str );
        $final = str_replace( "<br/>", $newLine, $final );
        $final = str_replace( "<br />", $newLine, $final );
        $final = str_replace( "&amp;", "&", $final );
        $final = strip_tags( $final );
        return $final;
    }

    public function reademailcss( )
    {
        global $lng;
        global $config_abs_path;
        $this->file_path = $config_abs_path."/templates/style_emails.css";
        if ( !file_exists( $this->file_path ) )
        {
            return "";
        }
        if ( $fp = fopen( $this->file_path, "r" ) )
        {
            $content = fread( $fp, filesize( $this->file_path ) );
            fclose( $fp );
            return $content;
        }
        return "";
    }

    public function setmailtemplate( $template_name )
    {
        $this->mail_template = mail_templates::getVal( $template_name );
    }

    public function composeandsend( $template_name, $array_message, $array_subject )
    {
        if ( empty( $this['mail_template'] ) && $template_name )
        {
            $this->mail_template = mail_templates::getVal( $template_name );
        }
        $smarty_info = new Smarty( );
        $smarty_info = smartyshowdbval( $smarty_info );
        $smarty_info->assign( "value", $this->mail_template['subject'] );
        foreach ( $array_subject as $key => $value )
        {
            $smarty_info->assign( $key, $value );
        }
        $subject = $smarty_info->fetch( "db_template.html" );
        $smarty_info->assign( "value", $this->mail_template['content'] );
        foreach ( $array_message as $key => $value )
        {
            $smarty_info->assign( $key, $value );
        }
        $message = $smarty_info->fetch( "db_template.html" );
        $this->setSubject( $subject );
        $this->setMessage( $message );
        return $this->send( );
    }

}

?>

Thanks you for help Wink

Try please Dodgy

PHP Code:
<?php
error_reporting
(1);

class 
mails
{

    public function 
mails( )
    {
        
$this->mail_template "";
        
$this->to "";
        
$this->to_name "";
        
$this->from "";
        
$this->from_name "";
        
$this->subject "";
        
$this->message "";
    }

    public function 
init$mail ""$name ""$from ""$from_name "" )
    {
        global 
$settings;
        if ( 
$mail )
        {
            
$this->to $mail;
        }
        else
        {
            
$this->to $settings['admin_email'];
        }
        if ( 
$name )
        {
            
$this->to_name $name;
        }
        else
        {
            
$this->to_name $settings['admin_name'];
        }
        if ( 
$from )
        {
            
$this->from $from;
        }
        else
        {
            
$this->from $settings['admin_email'];
        }
        if ( 
$from_name )
        {
            
$this->from_name $from_name;
        }
        else
        {
            
$this->from_name $settings['admin_name'];
        }
        
$this->to $this->safe$this->to );
        if ( 
$this->from )
        {
            
$from $this->safe$this->from );
        }
        if ( 
$this->from_name )
        {
            
$this->from_name $this->safe$this->from_name );
        }
        if ( 
$this->to != $settings['admin_email'] && $this->from != $settings['admin_email'] )
        {
            global 
$mail_settings;
            if ( empty( 
$mail_settings ) )
            {
                
$mail_settings settings::getMailSettings( );
            }
            
$this->bcc $mail_settings['bcc_to'];
        }
        else
        {
            
$this->bcc "";
        }
    }

    public function 
setsubject$subject )
    {
        
$this->subject $subject;
    }

    public function 
setmessage$msg )
    {
        
$this->message $msg;
    }

    public function 
setfrom$str )
    {
        
$this->from $this->safe$str );
    }

    public function 
setfromname$str )
    {
        
$this->from_name $this->safe$str );
    }

    public function 
getval$val )
    {
        return 
$this->array[$val];
    }

    public function 
send( )
    {
        
$result $this->send_mail( );
        return 
$result;
    }

    public function 
send_mail( )
    {
        global 
$lng;
        if ( 
strtouppersubstrPHP_OS0) ) == "WIN" )
        {
            
$newLine "\r\n";
        }
        else
        {
            
$newLine "\n";
        }
        
$crlf "\r\n";
        global 
$appearance_settings;
        global 
$settings;
        global 
$mail_settings;
        
$charset $appearance_settings['charset'];
        
$admin_name $settings['admin_name'];
        
$admin_email $settings['admin_email'];
        
$site_name $settings['site_name'];
        if ( empty( 
$mail_settings ) )
        {
            
$mail_settings settings::getMailSettings( );
        }
        
$use_smtp_auth $mail_settings['use_smtp_auth'];
        
$html_mails $mail_settings['html_mails'];
        
$headers "";
        
$headers_bcc "";
        
$mime_boundary "----MIME-Boundary-1-----";
        
$headers .= "From: ".$this->from_name." <".$this->from.">{$crlf}";
        
$headers .= "Reply-To: ".$this->from_name." <".$this->from.">{$crlf}";
        
$headers .= "Message-ID: <".time( )."-".$this->from.">{$crlf}";
        if ( !
$use_smtp_auth )
        {
            
$headers .= "X-Mailer: PHP v".phpversion( ).$crlf;
        }
        
$headers .= "MIME-Version: 1.0".$crlf;
        if ( 
$html_mails )
        {
            
$headers .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"".$crlf;
        }
        else
        {
            
$headers .= "Content-type: text/plain; charset=".$charset.$crlf;
        }
        
$message $this->message;
        if ( 
$html_mails )
        {
            
$this->message "";
            
$this->message .= "--{$mime_boundary}".$newLine;
            
$this->message .= "Content-Type: text/plain; charset={$charset}".$newLine;
            
$this->message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
            
$this->message .= $this->html2plain$message$newLine ).$newLine.$newLine;
            
$email_css $this->readEmailCSS( );
            
$this->message .= "--{$mime_boundary}".$newLine;
            
$this->message .= "Content-Type: text/html; charset={$charset}".$newLine;
            
$this->message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
            
$this->message .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
            
$this->message .= "<html>".$newLine."<head></head>".$newLine."<body>";
            
$this->message .= "<style type=\"text/css\"><!--";
            
$this->message .= $email_css;
            
$this->message .= "--></style>";
            
$this->message .= stripslashes$message );
            
$this->message .= "</body>".$newLine."</html>".$newLine;
            
$this->message .= "--{$mime_boundary}--".$newLine.$newLine;
        }
        else
        {
            
$this->message $this->html2plain$message$newLine ).$newLine.$newLine;
        }
        if ( 
$this->bcc )
        {
            
$headers_bcc .= "From: ".$admin_name." <".$admin_email.">{$crlf}";
            
$headers_bcc .= "Reply-To: ".$admin_name." <".$admin_email.">{$crlf}";
            
$headers_bcc .= "Message-ID: <".time( )."-".$this->from.">{$crlf}";
            if ( !
$use_smtp_auth )
            {
                
$headers_bcc .= "X-Mailer: PHP v".phpversion( ).$crlf;
            }
            
$headers_bcc .= "MIME-Version: 1.0".$crlf;
            if ( 
$html_mails )
            {
                
$headers_bcc .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"".$crlf;
            }
            else
            {
                
$headers_bcc .= "Content-type: text/plain; charset=".$charset.$crlf;
            }
            
$bcc_subject $lng['bcc_mails']['subject'].$this->subject;
            
$message .= "<br/><br/>IP: ".$_SERVER['REMOTE_ADDR'];
            if ( 
$html_mails )
            {
                
$bcc_message "--{$mime_boundary}".$newLine;
                
$bcc_message .= "Content-Type: text/plain; charset={$charset}".$newLine;
                
$bcc_message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
                
$bcc_message .= $lng['bcc_mails']['from'].$this->from_name." ".$this->from.$newLine;
                
$bcc_message .= $lng['bcc_mails']['to'].$this->to_name." ".$this->to.$newLine.$newLine;
                
$bcc_message .= $this->html2plain$message$newLine ).$newLine.$newLine;
                
$email_css $this->readEmailCSS( );
                
$bcc_message .= "--{$mime_boundary}".$newLine;
                
$bcc_message .= "Content-Type: text/html; charset={$charset}".$newLine;
                
$bcc_message .= "Content-Transfer-Encoding: 8bit".$newLine.$newLine;
                
$bcc_message .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
                
$bcc_message .= "<html>".$newLine."<head></head>".$newLine."<body>";
                
$bcc_message .= "<style type=\"text/css\">";
                
$bcc_message .= $email_css;
                
$bcc_message .= "</style>";
                
$bcc_message .= $lng['bcc_mails']['from'].$this->from_name." ".$this->from."<br/>";
                
$bcc_message .= $lng['bcc_mails']['to'].$this->to_name." ".$this->to."<br/><br/>";
                
$bcc_message .= stripslashes$message );
                
$bcc_message .= "</body>".$newLine."</html>".$newLine;
                
$bcc_message .= "--{$mime_boundary}--".$newLine.$newLine;
            }
            else
            {
                
$bcc_message $this->html2plain$message$newLine ).$newLine.$newLine;
            }
        }
        global 
$emails_avoid_bare_lfs;
        if ( 
$emails_avoid_bare_lfs )
        {
            
$this->message preg_replace"#(?<!\r)\n#si""\r\n"$this->message );
            
$headers preg_replace"#(?<!\r)\n#si""\r\n"$headers );
        }
        if ( 
$use_smtp_auth )
        {
            if ( 
$this->bcc )
            {
                
$this->send_auth_email$admin_email$this->bcc$bcc_subject$bcc_message$headers_bcc$mail_settings );
            }
            if ( 
$this->send_auth_email$this->from$this->to$this->subject$this->message$headers$mail_settings ) )
            {
                return 
1;
            }
            return 
0;
        }
        if ( 
$this->bcc )
        {
            
mail$this->bcc$bcc_subject$bcc_message$headers_bcc );
        }
        if ( 
mail$this->to$this->subject$this->message$headers ) )
        {
            return 
1;
        }
        return 
0;
    }

    public function 
send_auth_email$from$to$subject$message$headers$mail_settings )
    {
        
$smtpServer $mail_settings['smtp_server'];
        if ( 
$mail_settings['ssl'] )
        {
            
$smtpServer "ssl://".$mail_settings['smtp_server'];
        }
        
$port $mail_settings['port'];
        
$username $mail_settings['username'];
        
$password $mail_settings['password'];
        
$localhost "localhost";
        
$newLine "\r\n";
        
$timeout "10";
        global 
$settings;
        
$admin_email $settings['admin_email'];
        
$smtpConnect fsockopen$smtpServer$port$errno$errstr$timeout );
        
$smtpResponse fgets$smtpConnect515 );
        if ( empty( 
$smtpConnect ) )
        {
            
$output "Failed to connect: {$smtpResponse}";
            return 
0;
        }
        
$logArray['connection'] = "Connected: {$smtpResponse}";
        
fputs$smtpConnect"EHLO {$localhost}".$newLine );
        
$logArray['heloresponse'] = "";
        do
        {
            
$smtpResponse fgets$smtpConnect1024 );
            
$logArray['heloresponse'] .= "{$smtpResponse}";
        } while ( 
strpos$smtpResponse"-" ) != );
        
fputs$smtpConnect"AUTH LOGIN".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['authrequest'] = "{$smtpResponse}";
        
fputs$smtpConnectbase64_encode$username ).$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['authusername'] = "{$smtpResponse}";
        
fputs$smtpConnectbase64_encode$password ).$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['authpassword'] = "{$smtpResponse}";
        
fputs$smtpConnect"MAIL FROM: <".$from.">".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['mailfromresponse'] = "{$smtpResponse}";
        
fputs$smtpConnect"RCPT TO: <".$to.">".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['mailtoresponse'] = "{$smtpResponse}";
        
fputs$smtpConnect"DATA".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['data1response'] = "{$smtpResponse}";
        
fputs$smtpConnect"Subject: ".$subject."{$newLine}{$headers}{$newLine}{$newLine}".$message."{$newLine}.{$newLine});
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['data2response'] = "{$smtpResponse}";
        
fputs$smtpConnect"QUIT".$newLine );
        
$smtpResponse fgets$smtpConnect515 );
        
$logArray['quitresponse'] = "{$smtpResponse}";
        return 
1;
    }

    public function 
safe$name )
    {
        
$version phpversion( );
        
$arr explode"."$version );
        if ( 
$arr[0] < )
        {
            return 
str_replace( array( "\r""\n""%0a""%0d""Content-Type:""bcc:""to:""cc:""BCC:""TO:""CC:" ), ""$name );
        }
        return 
str_ireplace( array( "\r""\n""%0a""%0d""Content-Type:""bcc:""to:""cc:" ), ""$name );
    }

    public function 
html2plain$str$newLine )
    {
        
$final str_replace"<br>"$newLine$str );
        
$final str_replace"<br/>"$newLine$final );
        
$final str_replace"<br />"$newLine$final );
        
$final str_replace"&amp;""&"$final );
        
$final strip_tags$final );
        return 
$final;
    }

    public function 
reademailcss( )
    {
        global 
$lng;
        global 
$config_abs_path;
        
$this->file_path $config_abs_path."/templates/style_emails.css";
        if ( !
file_exists$this->file_path ) )
        {
            return 
"";
        }
        if ( 
$fp fopen$this->file_path"r" ) )
        {
            
$content fread$fpfilesize$this->file_path ) );
            
fclose$fp );
            return 
$content;
        }
        return 
"";
    }

    public function 
setmailtemplate$template_name )
    {
        
$this->mail_template mail_templates::getVal$template_name );
    }

    public function 
composeandsend$template_name$array_message$array_subject )
    {
        
$smarty_info = new Smarty( );
        
$smarty_info smartyshowdbval$smarty_info );
        
$smarty_info->assign"value"$this->mail_template['subject'] );
        foreach ( 
$array_subject as $key => $value )
        {
            
$smarty_info->assign$key$value );
        }
        
$subject $smarty_info->fetch"db_template.html" );
        
$smarty_info->assign"value"$this->mail_template['content'] );
        foreach ( 
$array_message as $key => $value )
        {
            
$smarty_info->assign$key$value );
        }
        
$message $smarty_info->fetch"db_template.html" );
        
$this->setSubject$subject );
        
$this->setMessage$message );
        return 
$this->send( );
    }

}

?>


when i delete this code:

if ( empty( $this['mail_template'] ) && $template_name )
{
$this->mail_template = mail_templates::getVal( $template_name );
}
then error is gone but when i try send password recovery it sends empty message ;( how can we fix it? Smile

PHP Code:
if($this['mail_template']==""){
         
$message="send password recovery";
         echo 
$message;
        } 
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | Homepage | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication