使用 Mailgun 服务提供商在 Google 云上使用 Swift Mailer 发送电子邮件

Sending Emails With Swift Mailer on Google Cloud using the Mailgun Service Provider

我安装了 Symfony 3.4 应用程序和 FOSUserBundle。我将该应用程序部署到 Compute Engine 实例。但是,当我尝试在每次注册后发送电子邮件时,出现以下错误。

 Exception occurred while flushing email queue: Connection could not be 
 established
 with host smtp.mailgun.org [Connection timed out #110] [] []

这是我的 parameters.yml 文件

parameters:
    mailer_transport: smtp
    mailer_host: smtp.mailgun.org
    mailer_user: postmaster@mydomain.tdl
    mailer_password: mailerpass

我也试过了

mailer_host: smtp.mailgun.org:587

我在Google云平台的防火墙规则列表中添加了587出端口,也没有用。

您似乎应该在 Compute Engine 上使用端口 2525,因为端口 25、465 和 587 上的出站连接是不允许的。您可以在 Mailgun documentation and Google Cloud Platform documentation and more.

上阅读更多内容

Google Compute Engine 已设计阻止所有标准传出 SMTP 端口。请在此处投票以更改 Google 的 SMTP 行为: https://googlecloudplatform.uservoice.com/forums/302595-compute-engine/suggestions/10079937-send-and-receive-email-using-tcp-smtp-imap-ports

除非他们打开 SMTP 端口,否则将无法从他们的云服务器发送电子邮件。 Sendgrid 和其他的太贵了,而且缺少很多需要的功能。