Mailer Error: Language string failed to load

作者:袖梨 2022-07-02

Mailer Error: Language string failed to load: [email protected],

今天在写给会员定时发邮件[phpmailer]时突然出现这种问题,经过仔细发查看发现是用户名与密码不正确造成的.下面为正确实可以发送邮箱的函数.

nclude_once("../pmail/class.phpmailer.php");
smtp_mail();

function smtp_mail () {
$mail    = new PHPMailer(); 
$mail->IsSMTP();                  // send via SMTP 
$mail->Host  = "smtp.163.com";   // SMTP servers 
$mail->SMTPAuth = true;           // turn on SMTP authentication 
$mail->Username = "mailangel123";     // SMTP username     注意:普通邮件认证不需要加 @域名
$mail->Password = "*******";          // SMTP password 
$mail->From  = "[email protected]";        // 发件人邮箱
$mail->FromName =  "您好,你很久没来这里了";    // 发件人
$mail->CharSet  = "GB2312";              // 这里指定字符集!
$mail->Encoding = "base64";
$mail->AddAddress("[email protected]","test");    // 收件人邮箱和姓名
$mail->AddReplyTo("[email protected]","163.com");
$mail->IsHTML(true);    // send as HTML            
$mail->Subject  = '您好,你很久没来这里了!'; // 邮件主题
$mail->Body = "test content";// 邮件内容
$mail->AltBody ="text/html"; 
$mail->Send();
if(!$mail->Send())
{
   echo "Message could not be sent.

";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}

echo "Message has been sent";
}

以mailangel改成你们自己的邮箱吧.

相关文章

精彩推荐