I'm trying to send a test email in Symfony 2.7.3 with swiftMailer nevertheless it isn't work. I looked many post even if it isn't work. The regular configuration for this often is:
Controller:
$message = \Swift_Message::newInstance()
->setSubject('Mensaje de prueba')
->setFrom('prueba1@gmail.com')
->setTo('prueba2@gmail.com')
->setBody(
$this->renderView(
'GuiasDocentesAppBundle:FAQ:plantillaEmail.html.twig',
array('correoConsultante' => $correoConsultante)
),
'text/html'
)
;
$this->get('mailer')->send($message);
Parameters.yml:
{ parameters: {
database_host: 127.0.0.1,
database_port: null,
database_name: databasename,
database_user: databaseuser,
database_password: databasepassword,
mailer_transport: gmail,
mailer_host: smtp.gmail.com,
mailer_user: prueba1@gmail.com,
mailer_password: passwordforprueba1,
secret: *******************************,
database_driver: pdo_mysql,
database_path: null } }
config_dev.yml && config.yml:
swiftmailer:
transport: "%mailer_transport%"
encryption: ssl
auth_mode: login
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
Actually, I'm in development enviroment but I think it isn't a issue. As you can see, prueba1@gmail.com is the same in controller and parameters.yml. The right account (prueba1@gmail.com) have been configured to work with external app without this link I hope somebody can help me. Thanks