Function Phpmailer can';无法发送电子邮件(无法实例化邮件功能;)
我的sendmail功能:Function Phpmailer can';无法发送电子邮件(无法实例化邮件功能;),function,email,phpmailer,sendmail,instantiation,Function,Email,Phpmailer,Sendmail,Instantiation,我的sendmail功能: $usr = $user; $body_msg = $this->getBodyEmail($fields); $email_from = 'contato@mydomain.com'; $email_name = 'Name'; require 'phpmailer/PHPMailerAutoload.php'; $mail = new PHPMailer; $mail->SetLanguage(
$usr = $user;
$body_msg = $this->getBodyEmail($fields);
$email_from = 'contato@mydomain.com';
$email_name = 'Name';
require 'phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->SetLanguage("br", "phpmailer/language/phpmailer.lang-br.php");
$mail->setFrom( $email_from, $email_name);
$mail->isHTML(true);
$mail->Subject = 'Contato';
$mail->Body = $body_msg;
$mail->addAddress($fields['email'], $fields['nome']);
我当然把域名藏起来了
因此,我尝试了$mail->send()
,但它不起作用,$mail->ErrorInfo代码>显示:“无法实例化邮件功能。
”
这个系统过去在没有SMTP的情况下工作,我不需要它
编辑:
我把SetFrom改成From和FromName,看起来效果不错
$mail->From = 'contato@mydomain.com';
$mail->FromName = 'Name';
$mail->From = 'contato@mydomain.com';
$mail->FromName = 'Name';
它可以是什么?我将SetFrom改为From和FromName,它似乎起了作用
$mail->From = 'contato@mydomain.com';
$mail->FromName = 'Name';
$mail->From = 'contato@mydomain.com';
$mail->FromName = 'Name';
我建议检查setFrom
调用的返回值,看看是否失败。