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.

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

报告相同问题?

悬赏问题

  • ¥15 ansys fluent计算闪退
  • ¥15 有关wireshark抓包的问题
  • ¥15 需要写计算过程,不要写代码,求解答,数据都在图上
  • ¥15 向数据表用newid方式插入GUID问题
  • ¥15 multisim电路设计
  • ¥20 用keil,写代码解决两个问题,用库函数
  • ¥50 ID中开关量采样信号通道、以及程序流程的设计
  • ¥15 U-Mamba/nnunetv2固定随机数种子
  • ¥15 vba使用jmail发送邮件正文里面怎么加图片
  • ¥15 vb6.0如何向数据库中添加自动生成的字段数据。