[英]symfony fosuserBundle, unable to send confirmation mail after registration
Symfony似乎无法发送确认邮件,这是我的代码,我尝试了所有操作,但没有结果。
这是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%'
这是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
这是config_dev.yml的代码:
swiftmailer:
transport: gmail
username: '%mailer_user%'
password: '%mailer_password%'
任何建议表示赞赏。
该问题可能是由于您在没有有效证书的本地环境中进行测试,因此无法建立与Gmail服务器的安全连接。
要使其正常工作,请尝试:
verify_peer
选项设置为false
: #config_dev.yml swiftmailer: transport: gmail username: '%mailer_user%' password: '%mailer_password%' stream_options: ssl: verify_peer: false
请注意,此设置并不安全,只能在开发环境中用于没有敏感数据的快速测试。 您还应该在swiftmailer配置中添加
delivery_addresses
选项,以将所有邮件发送到一个地址。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.