问题描述
我有一个Symfony 2.8应用程序,并实现了FosuserBundle.在dev环境中,注册确认邮件已发送,但在prod环境中未发送.没有日志消息,SMPT配置是正确的.
SF版本:2.8.1 SwiftMailer-Bundle版本:Current(与SF版本兼容; 2.*在作曲家JSON中) fosuserbundle:1.3.5(Composer中的*)
dev-config:
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
有人有同样的问题吗?
编辑
我只是在prod env中使用以下控制台命令的邮件:php sf --env=prod swiftmailer:email:send
终端输出:
#!/usr/bin/env php From: test@antondachauer.de To: mail@antondachauer.de Subject: test Body: test Sent 1 emails
但是邮件尚未发送.在dev env中,它也可以在终端中工作.
推荐答案
我尝试了所有提到的解决方案-com-173-194-205-108-0" rel =" nofollow noreferrer">在这里, 这是" gethostbyname"和" gmail的更改SMTP",但它不起作用.
挖掘了几天后,我找到了一个解决方案,您需要将加密更改为TLS,然后在Config中的stream_options中添加SSL.它不建议根据安全角度进行,但在我的情况下可以使用.
参数.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
问题描述
I have a symfony 2.8 app, with fosuserbundle implemented. In the dev environment, the registration confirm mails are sent, but not in the prod environment. There is no log message and the smpt configuration is correct.
sf version: 2.8.1 swiftmailer-bundle version: current (compatible with sf version; 2.* in composer json) fosuserbundle: 1.3.5 (* in composer)
dev-config:
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
Has anyone the same problem?
edit
I just tried a mail with the following console command in prod env: php sf --env=prod swiftmailer:email:send
Terminal output:
#!/usr/bin/env php From: test@antondachauer.de To: mail@antondachauer.de Subject: test Body: test Sent 1 emails
But the mail has not been sent. In the dev env, it works also in terminal.
推荐答案
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