in config.yml
# Swiftmailer Configuration
swiftmailer:
transport: sendmail
username: %mailer_user%
password: %mailer_password%
disable_delivery: false
in my controller:
$from = $data['email'];
//$sento = self::getSiteInfo()->getEmail();
$sento = 'devyoussef@gmail.com';
$message = \Swift_Message::newInstance()
->setSubject('Nouveau message')
->setFrom($from)
->setTo($sento)
->setBody(
$this->renderView(
'RootSiteBundle:Front:email.txt.twig',
array('data' =>$data)
)
);
$this->get('mailer')->send($message);