Send a confirmation email using FOSUserBundle

I use FOSUserBundle to do registration / registration in my application.

I want the new user to confirm their email by sending him an email with confirmation.

After reading the official documentation and various tutorials, I have the same error:

The email verification page appears after user registration, but I do not receive an email.

These are my settings.

#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: my_username@gmail.com
                sender_name: Demo registration
    service:
        mailer: fos_user.mailer.twig_swift

And these are my parameters

config/parameters.yml

parameters:
    mailer_transport: smtp
    mailer_host: smtp.gmail.com
    mailer_encryption: ssl
    mailer_user: my_username@gmail.com
    mailer_password: my_password

Please help me solve this problem? thank you's

+4
source share
2 answers

I think your problem is your configuration swiftmailer. Change the settings to

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

encryption auth_mode

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: my_username@gmail.com
    mailer_password: my_password

.

+1

gmail?. .

. .

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

Source: https://habr.com/ru/post/1625740/


All Articles