I want to send an email using symfony with gmail. I mean both the sender and the receiver use gmail. I configured the config.yml as follows :
swiftmailer:
transport: gmail
encryption: ssl
auth_mode: login
host: smtp.gmail.com
username: username
password: pass
spool: { type: memory }
$message = \Swift_Message::newInstance()
->setSubject('Hello Email')
->setFrom('sender@gmail.com')
->setTo('destination@gmail.com')
->setBody('hello')
Is this code correct?
An other note: when I added this code it worked
$form = $this->get('form.factory')->create(new xxxType(), array('key' => 'var'));
but with this it does not
$form = $this->createForm(new xxxType(),$entity);