使用Google Apps邮件帐户的PHP PEAR邮件失败-错误535身份验证失败 [英] PHP PEAR mail fails using Google Apps mail account - error 535 authentication failed

查看:337
本文介绍了使用Google Apps邮件帐户的PHP PEAR邮件失败-错误535身份验证失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PHP页面,该页面使用 PEAR Mail 通过Google Apps邮件帐户发送邮件.该页面仅在秋季和冬季处于活动状态,在1月最后一次使用时效果很好.

I have a PHP page that uses PEAR Mail to send a message through a Google Apps mail account. The page is only active in the fall and winter, and it was working great when it was last used in January.

现在,当我为秋天做准备时,此页面不再起作用.我遇到的问题与 SMTP错误535(错误认证数据)使用PEAR邮件该问题没有答案,并且不允许我发表评论,所以我开始了一个新问题.

Now, as I prep the site for the fall, this page no longer works. I have the exact same problem as described at SMTP Error 535 (Incorrect authentication data) using PEAR mail There have been no answers to that question and it won't allow me to comment, so I'm starting a new question.

我使用的代码与pavan kumar在使用GMail SMTP服务器从PHP页面发送电子邮件.

I am using code identical to that posted by pavan kumar at Send email using the GMail SMTP server from a PHP page .

错误消息是:

authentication failure [SMTP: Invalid response code received from server (code: 535, response: Incorrect authentication data)]

我仔细检查了邮件用户的登录名自1月以来没有更改.我将脚本中的地址和密码复制并粘贴到了浏览器的Gmail登录名中.它起作用了,所以我知道我的参数是正确的.此帐户是企业域地址,而不是@ gmail.com.

I double-checked that the login for the mail user had not been changed since January. I copied and pasted the address and password from my script into the Gmail login in my browser. It worked, so I know my parameters are correct. This account is a business domain address, not @gmail.com.

我正在尝试连接:

$host = "ssl://smtp.gmail.com";
$port = "465";

我也尝试指定tls://和端口587,不走运.根据另一个SO线程中的建议,我还将主机设置为"googlemail.com",而不是"gmail.com".

I also tried specifying tls:// and port 587, no luck. I also set the host to "googlemail.com" instead of "gmail.com" per a suggestion in another SO thread.

我对$ smtp对象执行了var_dump(),并确认我的地址和密码已成功且准确地传递给它.

I did a var_dump() of the $smtp object, and confirmed my address and password were passed into it successfully and accurately.

该帐户位于最近升级到PHP 5.3.5和Apache 2.2.22的cPanel系统上.变化似乎不太可能引发此问题,但是我提起它是为了防止它成为一个因素.

The account is on a cPanel system that recently upgraded to PHP 5.3.5 and Apache 2.2.22. It seems unlikely that change could have triggered this problem, but I mention it in case it could be a factor.

找到 http://support. google.com/a/bin/answer.py?hl=zh-CN&answer=176600 其中显示"...您必须使用设备或应用程序的IP地址为您的域配置SPF记录,以确保收件人不拒绝发送的邮件.您还必须将此IP地址添加到Google Apps控制面板的电子邮件白名单"框中.例如,如果您的发送设备从123.45.67.89发送,则将该地址添加到SPF记录中而不删除记录中的Google Apps邮件服务器..."不幸的是,我在此域中没有电子邮件白名单"框-它是免费的< 10用户帐户,显然没有该功能.

Found http://support.google.com/a/bin/answer.py?hl=en&answer=176600 which says "...you must configure an SPF record for your domain with the IP address of the device or application to ensure that recipients do not reject mail sent from it. You must also add this IP address to the Email Whitelist box in your Google Apps control panel. For example. if your sending device sends from 123.45.67.89, add that address to your SPF record without removing the Google Apps mail servers from the record..." Unfortunately I don't have an Email Whitelist box in this domain - it's the free <10 user account which evidently doesn't have that feature.

相关: http://support.google.com/mail/bin/answer.py?hl = zh-CN& answer = 78775

我在Opera邮件中设置了帐户,并使用AUTH LOGIN和AUTH PLAIN设置成功发送了邮件.

Edit 3: I set up the account in Opera mail, and sent successfully using both AUTH LOGIN and AUTH PLAIN settings.

推荐答案

问题出在我的Web主机上,而不是Google的邮件服务器上.

The problem was located at my web host, not Google's mail server.

该帐户位于cPanel服务器上,管理员已对其进行了设置,以便只有指定的用户帐户才能访问外部SMTP服务器.他禁用了该要求以便我进行测试,然后我的邮件系统立即开始工作.

The account is on a cPanel server, and the admin had set it so that only designated user accounts could access external SMTP servers. He disabled that requirement in order for me to test, and my mail system immediately started working.

但是,到目前为止,我还没有找到有关在激活SMTP身份验证后如何以授权用户身份登录cPanel的文档.如果找到一些,我将进行更新.

So far, though, I have found no documentation on how to log into cPanel as one of the authorized users when its SMTP Authentication is activated. I will update this if I find some.

这篇关于使用Google Apps邮件帐户的PHP PEAR邮件失败-错误535身份验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆