【问题标题】:Send email using sendgrid through swiftmailer from google cloud通过谷歌云中的 swiftmailer 使用 sendgrid 发送电子邮件
【发布时间】:2016-12-09 11:44:34
【问题描述】:

我正在尝试使用 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 成功。

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

【问题讨论】:

    标签: symfony email google-app-engine swiftmailer sendgrid


    【解决方案1】:

    您使用的是 App Engine 标准还是 App Engine 灵活?使用标准,您使用的客户端将需要使用套接字 API:

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

    如果您使用的是 App Engine Flexible,这应该“正常工作”:

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

    我们甚至在这里有一个示例:

    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

    希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-08
      相关资源
      最近更新 更多