[英]symfony fosuserBundle, unable to send confirmation mail after registration
Symfony seems to be unable to send confirmation mail, this is my code I tried everything but no result. Symfony似乎无法发送确认邮件,这是我的代码,我尝试了所有操作,但没有结果。
This is the code of config.yml : 这是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.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 : 这是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. 该问题可能是由于您在没有有效证书的本地环境中进行测试,因此无法建立与Gmail服务器的安全连接。
To make it work, try to: 要使其正常工作,请尝试:
verify_peer
option set to false
in the swiftmailer configuration: verify_peer
选项设置为false
: #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.您还应该在swiftmailer配置中添加
delivery_addresses
选项,以将所有邮件发送到一个地址。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.