<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl";
$mail->Host = "plus.smtp.mail.yahoo.com";
$mail->Port = 465; // set the SMTP port
$mail->Username = "sumthing@yahoo.com";
$mail->Password = "password";
$mail->From = "sumthing@yahoo.com";
$mail->FromName = "myname";
$mail->AddAddress("you@example.com");
$mail->Subject = "Test PHPMailer Message";
$mail->Body = "Hi! \n\n This was sent with phpMailer_example3.php.";
if (!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
?>
跑步后显示:
SMTP错误:无法进行身份验证。消息未发送.Mailer错误: SMTP错误:无法进行身份验证。 SMTP服务器错误:
是错误??
答案 0 :(得分:0)
PHP Mailer返回的错误通常是准确的,因此请确保使用正确的SMTP服务器凭据。
答案 1 :(得分:0)
也许用户名是sumthing,而不是sumthing@yahoo.com? 另外,首先尝试在没有SSL加密的情况下,在普通SMTP端口上发送,如果有效,您将知道SSL安全性存在问题。