Reputation: 14052
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 ?
Upvotes: 7
Views: 2856
Reputation: 1048
This is the FOSUser default mail:
{% block subject %}
{% autoescape false %}
{{ 'registration.email.subject'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}, 'FOSUserBundle') }}
{% endautoescape %}
{% endblock %}
{% block body_text %}
{% autoescape false %}
{{ 'registration.email.message'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}, 'FOSUserBundle') }}
{% endautoescape %}
{% endblock %}
{% block body_html %}{% endblock %}
At line 8, 'registration.email.message' is the email content. And trans
is a replace filter. Try something like this:
{% block subject %}
{% autoescape false %}
{{ 'Confirmez votre inscription sur blabla.com'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}, 'FOSUserBundle') }}
{% endautoescape %}
{% endblock %}
{% block body_text %}
{% autoescape false %}
{{ 'Bonjour %username%
Merci de cliquer sur le lien suivant afin de confirmer votre inscription sur blabla.com:
%confirmationUrl%'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}, 'FOSUserBundle') }}
{% endautoescape %}
{% endblock %}
{% block body_html %}{% endblock %}
Upvotes: 0
Reputation: 3260
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%.
Upvotes: 13