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.

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

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料