这是我的php代码
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->From = "example@gmail.com";
$mail->AddAddress("example@yahoo.com");
$mail->Subject = "First PHPMailer Message";
$mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50;
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
我的php.ini有这个邮件配置【邮件功能】
SMTP = smtp.gmail.com
smtp_port = 465
sendmail_from =example@gmail.com
我的错误是
以下发件人地址失败:example@gmail.com 邮件未发送。邮件程序错误:以下发件人地址失败:example@gmail.com SMTP 服务器错误:5.7.0 必须首先发出 STARTTLS 命令。i1sm13250552pbv.49
请帮助我。在此先感谢......