【phpmailer】类Could not instantiate mail function / IXWebHosting空间

今天,在IXWebHost 上用 phpmailer类 发送邮件,源代码是从我的justhost空间直接copy过来的,但在IXWebHost空间上,出现Could not instantiate mail function错误,后来发现时发现邮件头部的问题,还有发现的内容也有点不对...

之后修改 :

class.phpmailer.php

1. public function Send() 函数中,大约572-579行

            // Choose the mailer and send through it
            switch($this->Mailer) {
                case 'sendmail':
                    return $this->SendmailSend($header, $body);
                case 'smtp':
                    return $this->SmtpSend($header, $body);
                default:
                    return $this->MailSend($header, $this->Body);  //这行 by 111 ,处理发送邮件内错不正确的问题
            }

2.    protected function MailSend 函数 中,大约 676-684行

else {
                
                //by zhiqi 111 edit : ixwebhost 空间走的是这步
                $headers = substr($header,0,strpos($header,'Message-ID'));  //重新 处理头文件
                $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)),$body,$headers); //修改头文件变量
                //implement call back function if it exists
                $isSent = ($rt == 1) ? 1 : 0;
                $this->doCallback($isSent,$to,$this->cc,$this->bcc,$this->Subject,$body);
            }
原文地址:https://www.cnblogs.com/zhiqixue/p/2768121.html