$mail= new PHPmailer();
$mail-> IsSMTP();//telling the class to use SMTP
$mail->Host = gethostbyname('smtp.gmail.com');//SMTP server
$mail->SMTPDdebug =2; //enables SMTP debug information
$mail->SMTPAuth = true;//enable SMTP authentication
$mail->SMTPSecure = "tsl";//set the prefix to the server
$mail->Port =587;//set the SMTP port for thr GMAIL server
$mail->Username = "andriyvyhor@gmail.com";//GAMAIL username
$mail->Password ="andriyvyhor";
$mail->SetFrom=("andriyvyhor@gmail.com");
$mail->AddAddress("andriyvyhor@gmail.com");
$mail->Subject="TEXT";
$mail->Body="You sell your shares";
if(!$mail->Send())
{
echo "Mailer erro:".$mail->ErrorInfo;
}
else
{
echo "Message sent!";
}
}
我收到此错误
SMTP错误:无法进行身份验证。邮件程序错误:SMTP错误:无法进行身份验证。