Valdèse Kamdem
Valdèse Kamdem

Reputation: 150

Send email to confirm registration with FOSUserBundle

I use FOSUserBundle to perform login/registration on my application.

I want a new user to confirm his email by sending him a confirmation email.

After reading the official documentation and different tutorials i have the same error :

The check email page appear after i register a user but i don't receive the email.

This is my configurations

#config/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:    VK\UserBundle\Entity\User 
    registration:
        confirmation:
            enabled: true
            from_email:
                address: [email protected]
                sender_name: Demo registration
    service:
        mailer: fos_user.mailer.twig_swift

And this is my parameters

config/parameters.yml

parameters:
    mailer_transport: smtp
    mailer_host: smtp.gmail.com
    mailer_encryption: ssl
    mailer_user: [email protected]
    mailer_password: my_password

Please can some one help me solve this issue ? thank's

Upvotes: 4

Views: 7909

Answers (2)

Bayanaa
Bayanaa

Reputation: 53

Did you check your gmail?. I just solved my problem. It was

Access for less secure apps has been turned off

. After turn on I received email.

mailer_transport: gmail
mailer_auth_mode: login
mailer_encryption: ssl
mailer_host: smtp.gmail.com
mailer_user: ************
mailer_password: ********

Upvotes: 1

Federkun
Federkun

Reputation: 36999

I think that your problem is your swiftmailer configuration. Edit your parameters to

parameters:
    mailer_transport: gmail
    mailer_host:      ~
    mailer_user:      your_gmail_username
    mailer_password:  your_gmail_password

or add encryption and auth_mode attribute to your actual configuration

swiftmailer:
    transport: "%mailer_transport%"
    encryption:"%mailer_encryption%"
    host:      "%mailer_host%"
    username:  "%mailer_user%"
    password:  "%mailer_password%"
    auth_mode: "%mailer_auth_mode%"
    spool:     { type: memory }

parameters:
    mailer_auth_mode: login
    mailer_encryption: ssl
    mailer_host: smtp.gmail.com
    mailer_transport: smtp
    mailer_user: [email protected]
    mailer_password: my_password

Documentation can be found here.

Upvotes: 1

Related Questions