我使用FOSUserBundle在我的应用程序上执行登录/注册.
我希望新用户通过向他发送确认电子邮件来确认他的电子邮件.
阅读官方文档和不同的教程后,我有同样的错误:
The check email page appear after i register a user but i don’t receive the email.
这是我的配置
#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
这是我的参数
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
有人可以帮我解决这个问题吗?谢谢
最佳答案 我认为您的问题是您的swiftmailer配置.编辑您的参数
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
文档可以在here找到.