1
votes

I have problem to send email using gmail. When I tested form on my server mailer works ok but after moved website to another provider error ocured

INFO - Matched route "my_frontend_default_index" (parameters: "_controller": "My\FrontendBundle\Controller\DefaultController::indexAction", "_route": "my_frontend_default_index")
ERROR - Exception occurred while flushing email queue: Failed to authenticate on SMTP server with username "[email protected]" using 1 possible authenticators

my parameters.yml

parameters:
mailer_transport: gmail
mailer_encryption: ssl
mailer_auth_mode: login
mailer_host: smtp.gmail.com
mailer_user: '[email protected]'

my config.yml

swiftmailer:
   transport: gmail
   host:      smtp.gmail.com
   username:  '[email protected]'
   password:  'password'

Someone have idea where is the problem ?

1

1 Answers

1
votes

First of all why are you not using your parameter keys in your config? You shouldnt need to touch the config at all. Leave it as:

swiftmailer:
    transport:  %mailer_transport%
    host:       %mailer_host%
    username:   %mailer_user%
    password:   %mailer_password%
    port:       %mailer_port%
    encryption: %mailer_encrypt%

Then for your parameters.yml use:

parameters:
    # ...
    mailer_transport: gmail
    mailer_host:      ~
    mailer_user:      your_gmail_username
    mailer_password:  your_gmail_password
    mailer_port:      465

As suggested in http://symfony.com/doc/current/cookbook/email/gmail.html