PHPMAILER SERVER - > SMTP错误:密码命令失败SMTP connect()失败 [英] PHPMAILER SERVER ->SMTP ERROR: Password command failed SMTP connect() failed
问题描述
我试图发送电子邮件,当有人进入一个页面。这是支付宝付款确认。你支付的东西,在你看到你做的电子邮件是自动发送的页面。
im trying to send an email just when somebody enters on a page. It's for paypal payment confirmation. You pay something and in the page where you see what you did an email is send automatically.
代码是下一个:
function send_email($from, $to, $subject, $nombre,$apellido) {
$pagoReal = $_SESSION["Payment_Amount"];
$monedaReal = $_SESSION["currencyCodeType"];
$estado = $_SESSION['estado'];
$id = $_SESSION['idHash'];
$mail = new PHPMailer();
$mail->SMTPDebug=3;
$mail->IsSMTP();
$mail->Host = 'localhost';
$mail->CharSet = "UTF-8";
$mail->From = $from;
$mail->FromName = 'Notificación de pago via Paypal';
$mail->addAddress($to);
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->SMTPAuth = true;
$contenido = "<html><body>
<p>Han realizado un nuevo ingreso via Paypal</p><br>
Nombre del cliente: $nombre $apellido<br>
Cantidad que pagó: $pagoReal $monedaReal <br>
Estado de la reserva:$estado <br>
Enlace a la factura : href='xxxxx/$id<br>
</body></html>";
$mail->Subject = $subject;
$mail->Body = $contenido;
['tmp_name'],$_FILES['cv_contacto']['name']);
if (!$mail->Send()) {
echo 'Error enviando mensaje.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
return "Mailer Error: " . $mail->ErrorInfo;
} else {
return 1;
}
}
然后我调用函数
then i call the function
send_email('patata@patata.com', 'fran@patata.es','Payment of '. $firstName." ".$lastName,$firstName,$lastName);
我收到这个错误
错误:身份验证失败:通用失败2016-07-11 14:20:51 SMTP错误:密码命令失败:535 5.7.8错误:身份验证失败:泛型失败2016-07-11 14:20:51 CLIENT - > SERVER:QUIT 2016-07-11 14:20:51服务器 - >客户端:221 2.0.0 Bye 2016-07-11 14:20:51连接:关闭2016-07-11 14:20:51 SMTP connect()失败。错误enviando mensaje.Mailer错误:SMTP connect()失败。
Error: authentication failed: generic failure 2016-07-11 14:20:51 SMTP ERROR: Password command failed: 535 5.7.8 Error: authentication failed: generic failure 2016-07-11 14:20:51 CLIENT -> SERVER: QUIT 2016-07-11 14:20:51 SERVER -> CLIENT: 221 2.0.0 Bye 2016-07-11 14:20:51 Connection: closed 2016-07-11 14:20:51 SMTP connect() failed. Error enviando mensaje.Mailer Error: SMTP connect() failed.
任何想法我可以做什么?
Any idea of what can i do?
谢谢!
推荐答案
按照以下步骤/ strong>
Follow this steps.
使用应用密码:如果您使用两步验证,请尝试使用应用密码登录
。
Use an App Password: If you use 2-Step Verification, try signing in with an App Password.
允许不太安全的应用程序:如果您不使用两步验证,则
可能需要允许较不安全的应用访问您的帐户。
Allow less secure apps: If you don't use 2-Step Verification, you might need to allow less secure apps to access your account.
如果您最近更改了Gmail密码,则可能需要
重新输入您的Gmail帐户信息,或完全重复您的
Gmail帐户设置您的其他邮件客户端。如果
以上的提示没有帮助,请访问
https:// www。 google.com/accounts/DisplayUnlockCaptcha ,然后按照页面上的
步骤操作。如果您通过您的工作,学校或
其他机构使用Gmail,请访问
https://www.google.com/a/yourdomain.com/UnlockCaptcha ,并将
yourdomain.com 替换为您的域名。
If you recently changed your Gmail password, you might need to re-enter your Gmail account information or completely repeat your Gmail account setup on your other email client. If the tips above didn't help, visit https://www.google.com/accounts/DisplayUnlockCaptcha and follow the steps on the page. If you use Gmail through your work, school, or other organization, visit https://www.google.com/a/yourdomain.com/UnlockCaptcha and replace yourdomain.com with your domain name.
这篇关于PHPMAILER SERVER - > SMTP错误:密码命令失败SMTP connect()失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!