简体   繁体   English

Symfony3-SwiftMailer:不存在的参数“ mailer_encryption”

[英]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.

相关问题 [Symfony2] [SwiftMailer]您请求的参数“ sender_name”不存在 - [Symfony2][SwiftMailer] You have requested a non-existent parameter “sender_name” Symfony2 Monolog to Email错误为什么swiftmailer.transport.real是不存在的服务 - Symfony2 Monolog to Email Errors why swiftmailer.transport.real is non-existent service Symfony2:您已请求不存在的参数 - Symfony2: You have requested a non-existent parameter 您请求的服务“ Users_Users”不存在。 Symfony3 - You have requested a non-existent service “Users_Users”. Symfony3 Symfony 4:您请求的参数“区域设置”不存在 - Symfony 4: You have requested a non-existent parameter "locale" Symfony3您已请求不存在的服务“学说”。 MongoDB FOSUserBundle - Symfony3 You have requested a non-existent service “doctrine”. MongoDB FOSUserBundle 您已请求一个不存在的服务“ file.uploader”-Symfony3 - You have requested a non-existent service “file.uploader” - Symfony3 Symfony 2称不存在的服务“路由器” - Symfony 2 calling non-existent service “router” Symfony突然失败,“服务”session.storage.metadata_bag“依赖于不存在的参数” - Symfony is suddenly failing with “The service ”session.storage.metadata_bag“ has a dependency on a non-existent parameter” Symfony2致命错误您请求的参数java_path不存在 - Symfony2 fatal error You have requested a non-existent parameter java_path
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM