我刚刚安装了FOSUserbundle,我希望启用电子邮件确认。意思是如果有人注册用户应该收到带有激活链接的电子邮件。
这是config.yml文件:
fos_user:
db_driver: orm
firewall_name: main
user_class: Project\UserBundle\Entity\User
service:
mailer: fos_user.mailer.twig_swift
group:
group_class: Project\UserBundle\Entity\Group
profile:
form:
type: project_user_profile
registration:
form:
type: project_user_registration
confirmation:
enabled: true
#template: FOSUserBundle:Registration:email.txt.twig
from_email:
address: zairi.ibrahim@gmail.com
sender_name: Simlinx User Registration
并且
# Swiftmailer Configuration
swiftmailer:
transport: %mailer_transport%
encryption: %mailer_encryption%
host: %mailer_host%
username: %mailer_user%
password: %mailer_password%
spool: { type: memory }
和parameters.yml:
mailer_transport: gmail
mailer_encryption: ssl
mailer_host: ~
mailer_user: zairi.ibrahim
mailer_password: xxxxxxxxxxxx
它第一次起作用,但现在它不再起作用了!!
Thnks
答案 0 :(得分:0)
我有这个配置,适合我。如果您的配置是第一次使用,则 Gmail 可能阻止您的帐户发送带有symfony的邮件。
config.yml
# Swiftmailer Configuration
swiftmailer:
transport: %mailer_transport%
encryption:%mailer_encryption%
host: %mailer_host%
auth_mode: %mailer_auth_mode% login
username: %mailer_user%
password: %mailer_password%
spool: { type: memory }
和parameters.yml:
mailer_transport: smtp
mailer_encryption: ssl
mailer_host: smtp.gmail.com
mailer_auth_mode: login
mailer_user: zairi.ibrahim@gmail.com
mailer_password: xxxxxxxxxxxx