我尝试使用symfony2和swiftmailer从cli应用程序发送电子邮件。该应用程序托管在谷歌云中,我尝试使用的电子邮件服务是Sendgrid。
当我尝试从本地环境发送电子邮件时,它运行正常但是当尝试从谷歌云计算机发送时,我不断获得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)whiteout成功的所有组合。
有没有人之前有过相同的问题或有任何想法?
答案 0 :(得分:0)
您使用的是App Engine标准版还是App Engine灵活版?使用标准,您正在使用的客户端需要使用套接字API:
https://cloud.google.com/appengine/docs/php/sockets/
如果你正在使用App Engine Flexible,这应该“正常工作”:
我们甚至在这里有一个样本:
https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/appengine/flexible/sendgrid
如果您遇到标准问题,此处的另一个选择是使用发送网格HTTP API:
https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html
希望这有帮助!