Marcin Stefański
Marcin Stefański

Reputation: 55

FosUserBundle don't send email to resset password

I have a simple form to login and reminder password, I overwrite the FOSUser template and everything works fine, but when I want to email the password reminder I do not get it to the mail.

This looks like a swiftmailer and fos configuration in config.yml:

swiftmailer:
    transport: '%mailer_transport%'
    host: '%mailer_host%'
    username: '%mailer_user%'
    password: '%mailer_password%'
    spool: { type: memory }         
fos_user:
    db_driver: orm
    firewall_name: main
    user_class: AirblogBundle\Entity\User
    from_email:
        address: "[email protected]"
        sender_name: "Admin"
    resetting:
        email:
            from_email: 
                address:        [email protected]
                sender_name:    No Reply
        token_ttl: 0

After sending the email from the resetting/request path, I get the following information:

An email has been sent to [email protected]. It contains a link you must click to reset your password.

Which seems correct because the address entered in the form has the same ending, but my mailbox does not receive any message.

ps: One more question, how to simply overwrite the Twig template, so the login and reminder of the hymn was on one page? Do you need to overwrite the controller?

Upvotes: 4

Views: 2318

Answers (2)

Mcsky
Mcsky

Reputation: 1445

Did you configure the needed parameters of SwiftMailerBundle well ?

First of all I suggest you to use Symfony's command to check your swift mailer configuration.

Specify the good arguments to send you a debug mail with reading the help command

php app/console swiftmailer:email:send --help

You should receive a mail on the email address you wrote in command. After this step you can assume that your mail configuration is good

Reset your forget password request

One important (in the version installed on my project, composer requirement ~2.0) thing to know that is FOSUserBundle don't resend mail if you didn't click on the previous reset link sended BUT he display to you the message that he sended the mail.

If you want to "reset" your password request for a specific user

UPDATE user SET confirmation_token = NULL, password_requested_at = NULL WHERE username = "yourdebugusername"

Extending FOSUserBundle Twig templates

You should read this documentation

Basically you can override all the FOSUserTemplate under vendor/friendsofsymfony/user-bundle/Resources/views

I hope it's help !

Upvotes: 3

Athos
Athos

Reputation: 181

For overriding FOSUser twig template looks the Symfony Doc

Upvotes: 0

Related Questions