简体   繁体   中英

not recieving a confirmation email with fosuserbundle

i'm trying to do my first symfony project and i am using the 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:

    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:

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

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 :

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. Check the documentation for more details: http://symfony.com/doc/current/reference/configuration/swiftmailer.html

Eventually you'll need another value for the authentication mode.

EDIT (2016-02-19):

Instead of using smtp as mailer_transport you can use the shortcut gmail . Please see this article from the 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 . In your configuration you have the host set to 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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