【发布时间】:2016-03-03 20:35:38
【问题描述】:
无法在 freebsd 主机上的 prod 中的 Symfony 2.8.3 中通过 gmail 发送邮件,而它在 Windows 10 上运行,并且在 prod 和 dev 中具有相同的源代码。 [也无法在主机上获取邮件日志,这可能有助于解决此问题。]
更新:可以使用 PHP 的 mail() 函数发送邮件。使用 Swiftmailer 从控制器发送邮件不起作用。更改为使用 mailer_transport: smtp mailer_host: localhost 的参数不会使 Swiftmailer 能够从控制器发送。
parameters.yml:
mailer_transport: gmail
mailer_host: smtp.gmail.com
mailer_user: {valid address}
mailer_password: (valid password}
config.yml:
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
encryption: ssl
auth_mode: login
config_prod.yml:
monolog:
handlers:
mail:
type: fingers_crossed
action_level: critical
handler: buffered
buffered:
type: buffer
handler: swift
swift:
type: swift_mailer
from_email: "%mailer_user%"
to_email: "%mailer_user%"
subject: Error report!
level: debug
【问题讨论】:
-
为什么这个投票结果很接近?该应用程序正在使用 Monolog 来(尝试)发送错误警报。我应该放弃 Monolog 并编写自己的异常处理程序来做同样的事情吗?
标签: php symfony swiftmailer