Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/255.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在本地主机故障器上发送电子邮件_Php_Smtp_Phpmailer - Fatal编程技术网

Php 在本地主机故障器上发送电子邮件

Php 在本地主机故障器上发送电子邮件,php,smtp,phpmailer,Php,Smtp,Phpmailer,这是我的密码: $mail = new PHPMailer(); // create a new object $mail->IsSMTP(); // enable SMTP $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only $mail->SMTPAuth = true; // authentication enabled $mail->SMTPSecure = '

这是我的密码:

$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
$mail->Host = "smtp.gmail.com";
$mail->Port = 465; // or 587
$mail->IsHTML(true);
$mail->Username = "my email";
$mail->Password = "my password";
$mail->SetFrom("example@gmail.com");
$mail->Subject = "Test";
$mail->Body = "hello";
$mail->AddAddress("example2@gmail.com");

 if(!$mail->Send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
 } else {
    echo "Message has been sent";
 }
它不发送电子邮件并抛出此错误消息:

CLIENT -> SERVER: EHLO localhost
2018-08-10 08:45:27 CLIENT -> SERVER: AUTH LOGIN
2018-08-10 08:45:27 CLIENT -> SERVER: <credentials hidden>
2018-08-10 08:45:27 CLIENT -> SERVER: <credentials hidden>
2018-08-10 08:45:28 SMTP ERROR: Password command failed: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbs8534-5.7.14 qnkx1ftXmOKno0nsg7hE8GcJQABBOD5tKdlhHDkafCl07-nac1ZdHuBwSPvackU8MO9HbN534-5.7.14 wL4C9Cjxkmknf0s9OFWkEb0bJ5RT2WhX_jTZWvdW_5dHefiXvEwAYmQz5w7cXSjS3NbZJ5534-5.7.14 f4yqWmEo8j01hu6l2gBy4LIBheFtnm0B5UwvPFDJAyvRzdhhh4BB2Rr6nlUDPAMZCqmr1M534-5.7.14 oC3K4ztm4auxRpObbvxr-g_hSUJjNtEgeW7KvQ2N6MVLPZjBdA> Please log in via534-5.7.14 your web browser and then try again.534-5.7.14 Learn more at534 5.7.14 https://support.google.com/mail/answer/78754 t15-v6sm11430067wrn.34 - gsmtp
SMTP Error: Could not authenticate.
2018-08-10 08:45:28 CLIENT -> SERVER: QUIT
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
CLIENT->SERVER:EHLO localhost
2018-08-10 08:45:27客户端->服务器:身份验证登录
2018-08-10 08:45:27客户端->服务器:
2018-08-10 08:45:27客户端->服务器:
2018-08-10 08:45:28 SMTP错误:密码命令失败:534-5.7.14请通过534-5.7.14登录您的web浏览器,然后重试。534-5.7.14在534 5.7.14了解更多信息https://support.google.com/mail/answer/78754 t15-v6sm11430067wrn.34-gsmtp
SMTP错误:无法进行身份验证。
2018-08-10 08:45:28客户端->服务器:退出
SMTP连接()失败。https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
邮件程序错误:SMTP连接()失败。https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
我确信用户和密码是正确的。知道怎么了吗


注意,我使用的是localhost(xampp)

我甚至无法连接到
smtp.zoho.com
似乎是这样offline@IsThisJavascript哦,对不起,这是个打字错误。。编辑..如果你手动登录GMAIL邮件,是不是说有可疑的登录企图?您可能必须启用
允许不太安全的应用程序
,但这会损害您的gmail安全设置
$mail->SMTPDebug=2
,这样您就可以看到更多谷歌的言论,尽管它已经在您收到的错误消息中提供了指导,其中说“请通过您的web浏览器登录,然后重试”。按照故障排除指南的链接也将是一个非常好的主意,因为它确切地告诉您如何处理此问题,这里的许多问题的其他副本也是如此