I have been trying to send email using swiftmailer, however I am not able to do so, I am getting following exception
request.CRITICAL: Uncaught PHP Exception Swift_TransportException: "Failed to authenticate on SMTP server with username "[email protected]" using 1 possible authenticators" at /home/ubuntu/Symfony/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php line 184 [] []
Can anybody tell what am I missing here? It looks like authentication is failing for some reason.
here is the snippet from my config file:
swiftmailer:
transport: gmail
encryption: ssl
auth_mode: login
host: smtp.gmail.com
username: [email protected]
password: password
My Dev server has ubuntu v13 OS
Try removing from your config_dev.php
There is no need to specify the encryption: and auth_mode: if you're using transport: gmail See the symfony2.3 cookbook How to use Gmail to send Emails
Quick and dirty way to test the email options. Init a new symfony 2.3 project and in the Default controller in acme /DemoBundle put this action.
Twig templates in Acme/Demo/Bundle/Resources/views/Default Frontend template
mail.html.twig
The mailer template. email.txt.twig
Going to the /mail should send the email.