3

I have activated in the FOSUserBundle the email confirmation. It allows users to receive a link by mail after they registration.

registration:
    confirmation:
        enabled: true

But It's not really what I want. I just want to send a welcome mail to confirm their registration (with no confirmation link).

Is it possible to configurate that in the FOSUserBundle?

Kevin
  • 4,823
  • 6
  • 36
  • 70
  • Configured, I don't think so, but can be implement for sure, maybe you just need to find what event is called after registration and implement the task. – abdiel Mar 23 '16 at 15:24

1 Answers1

2

You can set a custom template for the email sent after registration:

confirmation:
    enabled:    true
    template:   YourUserBundle:Registration:email.txt.twig

Copy the default FOSUserBundle:Registration:email.txt.twig and remove the confirmation link.

But as the confirmation is set to true, your users will not be enabled by default.

So, if you want disable the whole confirmation feature, you can:

Hope this helps.

chalasr
  • 12,971
  • 4
  • 40
  • 82
  • `FOS\UserBundle\FOSUserEvents` is not found in my vendor. I'm using the version 1.3.x of the FOSUserBundle!!! Is it a new feature in the version 2 ? – Kevin Mar 24 '16 at 16:18
  • Yes, this feature is only available since 2.0. You need to use the firt of the two last options I given, that is overriding the RegistrationController. Create an email sending method into and call it from the registerAction in case of success. – chalasr Mar 24 '16 at 16:57
  • Ok so I have created my class `RegisterController` in the same path in my Bundle child. But the override doesn't seems to work. Is there something else to do in a .yml file? Like for exemple changing the provider. How does symfony know that it has to use my class now? ps: I'm using the SonataUserbundhe with FOSUserBundle. – Kevin Mar 25 '16 at 11:28
  • 1
    I just see your comment, sorry. [This question should help you](http://stackoverflow.com/questions/18571884/sonatauserbundle-fosuserbundle-overriding-controllers), tell me if it doesn't. – chalasr Mar 28 '16 at 16:58