1
votes

I am trying to send email in prod environment but it doesn't work... I am getting this log:

[2014-06-30 09:37:54] request.CRITICAL: Uncaught PHP Exception Swift_TransportException: "Expected response code 250 but got code "530", with message "530 5.7.0 Must issue a STARTTLS command first. o2sm28357522wia.16 - gsmtp "" at C:\xampp\htdocs\UniDocs\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php line 386 {"exception":"[object] (Swift_TransportException: Expected response code 250 but got code \"530\", with message \"530 5.7.0 Must issue a STARTTLS command first. o2sm28357522wia.16 - gsmtp\r\n\" at C:\xampp\htdocs\UniDocs\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php:386)"} []

However, in dev it is working...

The config I have is the following:

config_dev.yml:

swiftmailer: transport: smtp encryption: ssl auth_mode: login host: smtp.gmail.com username: [email protected] password: mypass

config.yml:

swiftmailer:
    transport: %mailer_transport%
    host:      %mailer_host%
    username:  %mailer_user%
    password:  %mailer_password%

parameters.yml:

mailer_transport: smtp
mailer_host: smtp.gmail.com
mailer_user: [email protected]
mailer_password: mypass

I also have another question..., in web/app.php do I have to write $kernel = new AppKernel('prod', false); or $kernel = new AppKernel('prod', true);??

1
use mailer_transport: gmail :) -- falseAlixB

1 Answers

8
votes

I've used my Gmail account to send emails in Symfony2, and I specify some parameters which you have not specified. Below is my configuration:

config.yml:

swiftmailer:
    transport: %mailer_transport%
    encryption: %mailer_encryption%
    auth_mode:  %mailer_auth_mode%
    host:      %mailer_host%
    username:  %mailer_username%
    password:  %mailer_password%
    spool:     { type: memory }

parameters.yml:

mailer_transport:  smtp
mailer_encryption: ssl
mailer_auth_mode:  login
mailer_host:       smtp.gmail.com
mailer_username: [email protected]
mailer_password: mypassword

Related with your second question, the original line is

$kernel = new AppKernel('prod', false);

If you change this to true, error messages can be showed in production mode, because the second parameter of the AppKernel construct indicates the debug mode.