我有一个 symfony 2.8 应用程序,并实现了 fosuserbundle。在里面dev
环境中,注册确认邮件已发送,但未在prod
环境。没有日志消息,smtp 配置正确。
科幻版本:2.8.1
swiftmailer-bundle 版本:当前(与 sf 版本兼容;2.*
在作曲家 json 中)
fosuserbundle:1.3.5(*
在作曲家中)
开发配置:
imports:
- { resource: config.yml }
framework:
router:
resource: "%kernel.root_dir%/config/routing_dev.yml"
#strict_requirements: true
profiler: { only_exceptions: true }
web_profiler:
toolbar: true
intercept_redirects: true
assetic:
use_controller: true
有人有同样的问题吗?
edit
我刚刚尝试使用以下控制台命令发送邮件prod
env: php sf --env=prod swiftmailer:email:send
终端输出:
#!/usr/bin/env php
From: [email protected] /cdn-cgi/l/email-protection
To: [email protected] /cdn-cgi/l/email-protection
Subject: test
Body: test
Sent 1 emails
但邮件尚未发送。在里面dev
env,它也可以在终端中运行。
我尝试了所有提到的解决方案here https://ourcodeworld.com/articles/read/373/swiftmailer-connection-could-not-be-established-with-host-smtp-gmail-com-173-194-205-108-0,
这是“gethostbyname”和“更改 Gmail 的 smtp”,但它不起作用。
经过几天的挖掘,我找到了解决方案,需要将加密更改为tls,并在config.json中的stream_options中添加ssl。从安全角度来看,不建议这样做,但它适用于我的情况。
参数.yml
mailer_prod_encryption: tls
配置.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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)