使用PHP从GMail发送邮件;代理

时间:2012-05-29 18:26:01

标签: php gmail

我正在使用PHP构建一个需要邮件功能的内部Web应用程序。 我使用过这里列出的代码:

Send email using the GMail SMTP server from a PHP page

当我从家里跑出来时,它就像一个魅力。但是,当我从办公室运行代码时,我得到以下结果:

Failed to connect to ssl://smtp.gmail.com:465 [SMTP: Failed to connect socket: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (code: -1, response: )]

知道怎么解决这个问题吗? 谢谢,
-JWW

2 个答案:

答案 0 :(得分:0)

这很可能是你工作场所的防火墙阻止了到465端口的传出连接。你试过端口587吗?

答案 1 :(得分:0)

我同意上面的响应者 - 这很可能是防火墙阻止端口465上的出站连接。您可以尝试使用端口587上的TLS连接或每个Gmail的故障排除文档端口25:http://support.google.com/mail/bin/answer.py?hl=en&answer=78775

如果您无法解决此问题(例如,如果IT不会删除阻止),您可以尝试使用第三方API作为代理。除了我们自己的MTA之外,我们的产品http://PostageApp.com可以使用外部邮件服务器(如Gmail),并且通过标准的http REST调用进行通信,从而避免出现防火墙问题。

我们是付费服务,但也有免费计划...如果您要发送的电子邮件超过我们的免费计划允许(100 /天),那么您可能会违反Gmail的发送限制它限制第三方客户约100 /天出境。

http://help.postageapp.com/kb/quick-start-guides/php

免责声明:我为PostageApp工作

相关问题