2016-08-03 92 views
2

我想从一个cli应用程序使用symfony2与swiftmailer发送电子邮件。该应用程序托管在谷歌云,我试图使用的电子邮件服务是Sendgrid。使用sendmail发送电子邮件通过谷歌云swiftmailer

当我试图从它完美对当地环境发送电子邮件,但如果试图从谷歌云机器,我不断收到Exception occurred while flushing email queue: Connection could not be established with host smtp.sendgrid.net [Connection timed out #110]

我添加了端口2525和465的防火墙规则发送时云计算机。

telnet smtp.sendgrid.net 2525完美地在机器上工作(并且是唯一可用的端口)。我已经尝试了所有sengrid邮件端口(465,2525,587)和加密类型(tls,ssl)成功的组合。

有没有人有过同样的问题或有任何想法?

回答

0

您是否在使用App Engine标准或App Engine灵活?有了标准,你正在使用的客户端需要使用套接字API:

https://cloud.google.com/appengine/docs/php/sockets/

如果您在使用App Engine的灵活,这应该 “只是工作”:

https://cloud.google.com/php/

我们甚至这里有一个例子:

https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/appengine/flexible/sendgrid

如果你被困在标准,另一个选择是使用send电网HTTP API:

https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html

希望这有助于!

相关问题