PHPMailer身份验证失败

时间:2014-05-09 08:54:32

标签: php authentication phpmailer

起初;抱歉我的英语能力差。我已经尝试改进它们了。

这是我的问题。我想用phpmailer发送一些邮件。但是邮件程序无法对我的每个邮件帐户进行身份验证。有趣的是两天前一切都运作良好。

至少我已经尝试过自述文件中的脚本并输入了我的电子邮件信息,但它仍然无法正常工作。

我现在不知道该怎么做,希望你可以帮助我

require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->IsSMTP();                                      // set mailer to use SMTP
$mail->Host = "smtp1.MyServer.de";  // specify main and backup server
$mail->SMTPAuth = true;     // turn on SMTP authentication
$mail->Username = "mymail@example.com";  // SMTP username
$mail->Password = "mypass"; // SMTP password

$mail->From = "mymail@example.com";
$mail->FromName = "Mailer";
$mail->AddAddress("mymail2@example.com", "test");


$mail->WordWrap = 50;                                 // set word wrap to 50 characters

$mail->IsHTML(true);                                  // set email format to HTML

$mail->Subject = "Here is the subject";
$mail->Body    = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";

if(!$mail->Send())
{
   echo "Message could not be sent. <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}

echo "Message has been sent";

1 个答案:

答案 0 :(得分:1)

添加以下行并尝试:

$mail->SMTPSecure = "ssl"; 
$mail->Port = 465; 

$mail->SMTPSecure = "tls"; 
$mail->Port = 587; 

希望这有帮助