fosUserBundle sends email registration empty

email, fosuserbundle, swiftmailer, symfony, twig

Solution

It's because the email is content obtained using translator and you have wrong configuration.

Make sure you have the translator enabled:

# app/config/config.yml
framework:
    translator: { fallback: %locale% }

# app/config/parameters.yml
parameters:
    locale: en # default locale

Also if you write your app in different language than english, make sure the key `registration.email.message` is translated into it. If it's not, you can override the translations by writing following file:

# app/Resources/FOSUserBundle/translations/FOSUserBundle.{your_locale}.yml
registration:
    email:
        subject: Registration email subject
        message: |
            Here you can place the content of the email.
            It can be multiline and you even have access to
            variables %username% and %confirmationUrl%.

Problem

so when i registre via fosUserBundle form on production env it sends an email to my gmail but there is no confirmation link in the email, there is just this ``` registration.email.message ``` in the title and in the body of the email, someone knows why ?

Original source