如何为控制器设置sender_name在FOSUserBundle中重置?

时间:2014-09-22 17:49:36

标签: email symfony fosuserbundle

我想在重置期间更改电子邮件的sender_name名称。 我已经在注册时完成了这项工作并且成功了。 这可以通过定义fos_user.registration.confirmation.from_email.sender_name轻松完成。

现在,我想知道为重置做同样的事情,但没有发送电子邮件。 如果我删除了重置 的配置(如下所示),则会发送电子邮件!

fos_user:
    db_driver: orm 
    firewall_name: main
    user_class: Minn\UserBundle\Entity\User
    registration:
        form:
            type: minn_user_registration 
        confirmation:
            enabled:    true 
            template:   MinnUserBundle:Registration:email.txt.twig        
            from_email:
                address: %the_address%
                sender_name: %the_name% 
    resetting:
        token_ttl: 86400
        email:
            from_email:
                address:        %the_address%
                sender_name:    %the_name% 
    service:
        mailer:  fos_user.mailer.twig_swift

那么,任何想法? 感谢

1 个答案:

答案 0 :(得分:2)

找到解决方案!

我忘了指定fos_user.resetting.form.*,如下所示......

fos_user:
    db_driver: orm 
    firewall_name: main
    user_class: Minn\UserBundle\Entity\User
    registration:
        form:
            type: minn_user_registration 
        confirmation:
            enabled:    true 
            template:   MinnUserBundle:Registration:email.txt.twig        
            from_email:
                address: %the_address%
                sender_name: %the_name% 
    resetting:
        token_ttl: 86400
        email:
            from_email:
                address:        %the_address%
                sender_name:    %the_name% 
        form:
            type:               fos_user_resetting
            name:               fos_user_resetting_form
            validation_groups:  [ResetPassword, Default]  
    service:
        mailer:  fos_user.mailer.twig_swift

希望它会帮助别人......