简体   繁体   English

无法通过fosuserbundle收到确认电子邮件

[英]not recieving a confirmation email with fosuserbundle

i'm trying to do my first symfony project and i am using the fosuserbundle. 我正在尝试做我的第一个symfony项目,并且正在使用fosuserbundle。 It's working perfectly i'm just having a problem with the email confirmation, i'm not receiving anything. 它工作正常,我只是在电子邮件确认方面遇到问题,我什么也没收到。

This is my parameters.yml: 这是我的parameters.yml:

parameters: 参数:

    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

this is myconfig.yml: 这是myconfig.yml:

swiftmailer: swiftmailer:

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

fos_user: 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

please can you help? 请你能帮忙吗? because i searched on the web and tried but since it's my first project none of the solutions are working with me. 因为我在网上搜索并尝试过,但是由于这是我的第一个项目,因此没有任何解决方案与我合作。

Try with these slight changes in your config.yml : 尝试在config.yml进行以下细微更改:

port: 585
auth_mod: login

The value for the port doesn't need to be enclosed in quotes. 端口的值不需要用引号引起来。 I'm not sure if this really makes a difference, but you should follow the conventions. 我不确定这是否真的有所作为,但是您应该遵循约定。

Since you're using smtp as mailer_transport you have also to specify the authentication mode. 由于您将smtp用作mailer_transport ,因此还必须指定身份验证模式。 Check the documentation for more details: http://symfony.com/doc/current/reference/configuration/swiftmailer.html 检查文档以了解更多详细信息: http : //symfony.com/doc/current/reference/configuration/swiftmailer.html

Eventually you'll need another value for the authentication mode. 最终,身份验证模式需要另一个值。

EDIT (2016-02-19): 编辑(2016-02-19):

Instead of using smtp as mailer_transport you can use the shortcut gmail . 除了使用smtp作为mailer_transport您还可以使用gmail快捷方式。 Please see this article from the Symfony Cookbook: http://symfony.com/doc/current/cookbook/email/gmail.html 请参阅Symfony Cookbook上的这篇文章: http : //symfony.com/doc/current/cookbook/email/gmail.html

Then you can omit the line: 然后,您可以省略以下行:

auth_mod: login

This shortcut will set the host to smtp.gmail.com . 此快捷方式会将host设置为smtp.gmail.com In your configuration you have the host set to 127.0.0.1. 在您的配置中,您将主机设置为127.0.0.1。 This could eventually be the reason why it works with the web_profiler , but not with the real e-mail address. 这最终可能是它可以与web_profiler一起使用但不能与真实的电子邮件地址一起使用的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM