Kiwwito

Code Snippets and More

Symfony 1.x comes integrated with Swift Mailer, we can send an email from every action with the next code

//Mail creation
$mailer = Swift_Mailer::newInstance(Swift_MailTransport::newInstance());

//Message creation
$message = Swift_Message::newInstance('Subject')
    ->setFrom(array('user@test.com' => 'Username'))
    ->setTo(array('to@test.com' => 'Receiver name'))
    ->setBody('Email content');

//Send the email
$mailer->send($message);

Recent comments

© 2014 Copyright by Keyvan Akbary