【发布时间】:2012-12-24 18:16:16
【问题描述】:
在过去的 2 个小时里,我一直在网上查看是否有其他人遇到过这个问题,而且似乎很多人遇到过这个问题,但没有一个答案对我有用。
SMTP -> FROM SERVER:220 mx.google.com ESMTP vq7sm928004oeb.13
SMTP -> FROM SERVER: 250-mx.google.com at your service, [50.57.114.141] 250-SIZE 35882577 250-8BITMIME 250-STARTTLS 250 ENHANCEDSTATUSCODES
SMTP -> FROM SERVER:220 2.0.0 Ready to start TLS
SMTP -> FROM SERVER: 250-mx.google.com at your service, [50.57.114.141] 250-SIZE 35882577 250-8BITMIME 250-AUTH LOGIN PLAIN XOAUTH XOAUTH2 250 ENHANCEDSTATUSCODES
SMTP -> FROM SERVER:530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 vq7sm928004oeb.13
SMTP -> ERROR: MAIL not accepted from server: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 vq7sm928004oeb.13
The following From address failed: my@email.com
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->SMPTAuth = true;
$mail->SMTPSecure = 'tls';
$mail->Host = "smtp.gmail.com";
$mail->Mailer = "smtp";
$mail->Port = 587;
$mail->Username = "my@email.com";
$mail->Password = "password";
我已经尝试了几乎所有 PHPMailer 的设置,但还是不知道哪里出了问题,我需要处理任何服务器设置吗?
我也尝试了普通的 php mail() 函数,但这也不是发送邮件,虽然在使用 Drupal 表单时它只是发送一封电子邮件。
【问题讨论】:
-
使用
$mail->SMTPSecure = 'ssl';l 并检查.. -
尝试将端口更改为 25 或尝试使用非 gmail 帐户。