[英]Symfony3 - SwiftMailer : non-existent parameter “mailer_encryption”
My App in Symfony 3.2.4 and PHP 5.6.28 我在Symfony 3.2.4和PHP 5.6.28中的应用
Everything is up to date : My SwiftMailer version : 一切都是最新的:My SwiftMailer版本:
symfony/swiftmailer-bundle (v2.5.4) symfony / swiftmailer-bundle(v2.5.4)
When I read the official doc it's written that I can add parameters for SwiftMailer like this : 当我阅读官方文档时,写到可以为SwiftMailer添加参数,如下所示:
config.yml 配置文件
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
encryption: "%mailer_encryption%"
port: "%mailer_port%"
spool: { type: memory }
logging: true
parameters.yml parameters.yml
parameters:
database_host: localhost
database_port: null
database_name: BASE
database_user: root
database_password: root
mailer_host: smtp-relay._.com
mailer_port: 587
mailer_transport: smtp
mailer_encryption: tls
mailer_user: -
mailer_password: -
secret: -
But when I run a "composer update" I always get the same error : 但是,当我运行“ composer update”时,总是会出现相同的错误:
[Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException] You have requested a non-existent parameter "mailer_encryption" [Symfony \\ Component \\ DependencyInjection \\ Exception \\ ParameterNotFoundException]您请求的参数不存在“ mailer_encryption”
I have to comment "encryption" and "port" in config.yml and do a "composer update" again. 我必须在config.yml中注释“加密”和“端口”,然后再次进行“合成器更新”。
It's the normal behavior of SwiftMailer Bundle ? 这是SwiftMailer Bundle的正常行为吗? Can someone help me ? 有人能帮我吗 ?
I'm using FOSuser. 我正在使用FOSuser。
If anyone encounters this problem again it is because on update, composer looks at parameters.yml.dist
which is being used as a template and if you have parameters in parameters.yml
which are not present in the template they will get removed. 如果有人再次遇到这个问题,是因为在更新,作曲家着眼于parameters.yml.dist
它被用作模板,如果你在参数parameters.yml
这是不存在的,他们会移除模板。
so in parameters.yml.dist
you will have to add the field: 因此,在parameters.yml.dist
您必须添加字段:
paremeters:
....
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_encryption: ~ (<!-- this line was added -->)
mailer_user: ~
mailer_password: ~
...
then you can add the value in parameters.yml
like you did before and use it in config.yml
然后您可以像以前一样将值添加到parameters.yml
中,并在config.yml
使用它
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
encryption: "%mailer_encryption%" (<!-- like this -->)
port: 587
spool: { type: memory }
logging: true
Same thing applies for the port 同样的事情也适用于港口
I resolved it a week ago like this : 我一周前解决了这个问题:
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
encryption: tls
port: 587
spool: { type: memory }
logging: true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.