简体   繁体   中英

PHP Mail SMTP Bug?

This isn't exactly exactly a bug because the function still works but if E_ALL error reporting is turn on, and I send multiple email request to a mail function, I get this notice and I am not sure if this a problem worth solving or not.

Notice: Only variable references should be returned by reference in /usr/share/pear/Mail/mime.php

When I Google the error, it reports to be a bug that was solved(or should have been) a long time ago. I am not sure this matters, but this is the function the email request are being sent too:

public static function sendEMailSMTP($args = array()) {

        if(self::_hasAdapter(get_class(), __FUNCTION__) )
            return self::_callAdapter(get_class(), __FUNCTION__, $args);

        $args += self::getEmailDefaults();
        $args = self::_applyFilter( get_class(), __FUNCTION__ , $args , array('event'=>'args'));

        if(is_array($args)){

            extract($args);

            $config=pv_getSiteEmailConfiguration();

            if(empty($smtp_username)){
                $smtp_username=$config['smtp_username'];
            }

            if(empty($smtp_password)){
                $smtp_password=$config['smtp_password'];
            }

            if(empty($smtp_host)){
                $smtp_host=$config['smtp_host'];
            }

            if(empty($smtp_port)){
                $smtp_port=$config['smtp_port'];
            }

            require_once "Mail.php";
            require_once 'Mail/mime.php';

            $stmp_info= array (
                'host' => $smtp_host,
                'port' => $smtp_port,
                'auth' => true,
                'username' => $smtp_username,
                'password' => $smtp_password
            );

            $headers = array (
                'From' => $sender,
                'To' => $receiver,
                'Subject' => $subject
            );


            if(!empty($args['carboncopy'])){
                $headers['Cc']=$args['carboncopy'];
                $receiver.=','.$args['carboncopy'];
            }

            if(!empty($args['blindcopy'])){
                $headers['Bcc']=$args['blindcopy'];
                $receiver.=','.$args['blindcopy'];
            }

            if(!empty($args['reply_to'])){
                $headers['Reply-To']=$args['reply_to'];
            }

            if(!empty($args['return_path'])){
                $headers['Return-Path']=$args['return_path'];
            }

            if(!empty($args['errors_to'])){
                $headers['Errors-To']=$args['errors_to'];
            }

            if(!empty($args['message_id'])){
                $headers['Message-ID']=$args['message_id'];
            }

            if(empty($text_message)){
                $text = strip_tags($message);
            } else {
                $text = $text_message;
            }

            if(empty($html_message)){
                $html = $message;
            } else {
                $html= $html_message;
            }

            $mime = new Mail_mime("\n");
            $mime->setTXTBody($text);
            $mime->setHTMLBody($html);
            if(!empty($attachment)){
                if(is_array($attachment)) {
                    foreach($attachment as $file) {
                        if(file_exists($file))
                            $mime->addAttachment($file , PVFileManager::getFileMimeType($file));
                    }//end foreach
                } else {
                    $mime->addAttachment($attachment, PVFileManager::getFileMimeType($attachment));
                }
            }

            $body = $mime->get();
            $headers = $mime->headers($headers);

            $smtp = Mail::factory('smtp', $stmp_info);
            $mail = $smtp->send($receiver, $headers, $body);
            self::_notify(get_class().'::'.__FUNCTION__, $args);
        }

    }//end sendEmailPHPSMTP

It means the Mail/Mime.php library is coded for obsolete php standards, and is most likely doing something like

$var =& new Obj();

In recent PHP versions, objects are always returned as references, so specifying a reference assignment triggers this warning. It's not harmful, but is something that should be fixed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM