Symfony seems to be unable to send confirmation mail, this is my code I tried everything but no result.
This is the code of config.yml:
fos_user:
db_driver: orm
firewall_name: main
user_class: BackOfficeBundle\Entity\User
service:
mailer: fos_user.mailer.twig_swift
registration:
confirmation:
enabled: true
from_email:
address: '%mailer_user%'
sender_name: '%mailer_user%'
from_email:
address: '%mailer_user%'
sender_name: '%mailer_user%'
This is the code of parameters.yml:
parameters:
database_host: 127.0.0.1
database_port: null
database_name: fos
database_user: root
database_password: null
mailer_transport: gmail
mailer_auth_mode: login
mailer_encryption: ssl
mailer_host: smtp.gmail.com
mailer_user: mail.mail@gmail.com
mailer_password: 000000
secret: ThisTokenIsNotSoSecretChangeIt
This is the code of config_dev.yml:
swiftmailer:
transport: gmail
username: '%mailer_user%'
password: '%mailer_password%'
The user is created and in description it said that i should check my email
Any suggestion is appreciated.
The issue probably comes from the fact that you're testing in a local environment without a valid certificate, thus you can't establish a secure connection to the Gmail server.
To make it work, try to:
verify_peer
option set to false
in the swiftmailer configuration:#config_dev.yml swiftmailer: transport: gmail username: '%mailer_user%' password: '%mailer_password%' stream_options: ssl: verify_peer: false
Note that this setup is not secure and should only be used in the dev environment for quick tests without sensitive data. You should also add the
delivery_addresses
option in swiftmailer configuration to send all mails to one address.