没有收到带有FosuserBundle的确认电子邮件


not recieving a confirmation email with fosuserbundle

我正在尝试做我的第一个Symfony项目,我正在使用fosuserbundle。它运行良好,我只是在电子邮件确认方面遇到问题,我没有收到任何东西。

这是我的参数.yml:

参数:

    database_host: 127.0.0.1
    database_port: null
    database_name: mydatabase
    database_user: root
    database_password: null
    mailer_transport: smtp
    mailer_host: 127.0.0.1
    mailer_user: mymail@gmail.com
    mailer_password: mypass
    secret: 8c73d1f9bc7f50ce500d4a98a4627ffaa42dc905

这是myconfig.yml:

Swiftmailer:

transport: %mailer_transport%
host:      %mailer_host%
username:  %mailer_user%
password:  %mailer_password%
port: "585"
spool:     { type: memory }

fos_user:

db_driver:     orm          
firewall_name: main           
user_class:    OC'UserBundle'Entity'User 
service:
        mailer: fos_user.mailer.twig_swift
registration:
    confirmation:
        enabled:    true
        from_email: 
            address: mymail@gmail.com
            sender_name: myname
 service:
    mailer:  fos_user.mailer.twig_swift

请问你能帮忙吗? 因为我在网上搜索并尝试过,但由于这是我的第一个项目,没有一个解决方案与我合作。

尝试在config.yml中进行这些细微更改:

port: 585
auth_mod: login

端口的值不需要括在引号中。我不确定这是否真的有所作为,但您应该遵循惯例。

由于smtp使用mailer_transport因此还必须指定身份验证模式。有关更多详细信息,请查看文档:http://symfony.com/doc/current/reference/configuration/swiftmailer.html

最终,身份验证模式需要另一个值。

编辑(2016-02-19(:

您可以使用快捷方式gmail,而不是使用smtp作为mailer_transport。请参阅Symfony Cookbook中的这篇文章:http://symfony.com/doc/current/cookbook/email/gmail.html

然后你可以省略以下行:

auth_mod: login

此快捷方式会将host设置为 smtp.gmail.com 。在配置中,将主机设置为 127.0.0.1。这可能最终成为它适用于web_profiler的原因,但不适用于真实的电子邮件地址。