symfony swiftmailer: mail not sent in prod-environment

自作多情 提交于 2019-12-05 12:25:13
sokphea chea

I tried all the solutions mentioned here, which is "gethostbyname" and "change smtp of Gmail" but it did not work.

After a few days of digging, I found a solution, you need to change the encryption to tls, and add ssl in stream_options in config. It's not recommended according to the security standpoint, but it works in my case.

parameters.yml

mailer_prod_encryption: tls

config.yml

swiftmailer:
  transport:  "%mailer_dev_transport%"
  host:       "%mailer_dev_host%"
  username:   "%mailer_dev_user%"
  password:   "%mailer_dev_password%"
  encryption: "%mailer_dev_encryption%"
  auth_mode:  "%mailer_dev_auth_mode%"
  spool:     { type: memory }
  port: 25
  stream_options:
    ssl:
      allow_self_signed: true
      verify_peer: false
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!