doushou5761 2016-03-03 20:35
浏览 57
已采纳

无法通过Gmail发送电子邮件

Unable to send mail via gmail in Symfony 2.8.3 in prod on freebsd host while it works on Windows 10 with same source code in both prod & dev. [Also unable to get a log of mailing on host, which might help resolve this.]

Update: Mail can be sent using PHP's mail() function. Using Swiftmailer to send mail from a controller does not work. Changed parameters to use mailer_transport: smtp mailer_host: localhost does not enable Swiftmailer to send from a controller.

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
  • 写回答

1条回答 默认 最新

  • douqing5981 2016-03-05 16:32
    关注

    In the absence of any other solution or finding a way to log Swiftmailer behavior I added a custom exception listener to send mail locally.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集