1. Go to this page and download the library: Download fbeen/mailerbundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fbeen / mailerbundle example snippets
$bundles = array(
...
new Fbeen\MailerBundle\FbeenMailerBundle(),
);
/*
* send an email to the admins
*/
$this->get('fbeen_mailer')
->setSubject('New contact request!')
->setTemplate('email/contact_request.html.twig')
->setData(array(
'name' => $name,
'email' => $email,
'message' => $message,
))
->sendMail()
;
/*
* send an email to the user
*/
$this->get('fbeen_mailer')
->setTo($user->getEmail())
->setSubject('Welcome on board!')
->setTemplate('email/welcome.html.twig')
->setData(array(
'user' => $user,
))
->sendMail()
;
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
class DefaultController extends Controller
{
public function emailAction()
{
$user = new User();
$user->setName('Frank Beentjes');
$user->setEmail('[email protected]');
return new Response(
$this->get('fbeen_mailer')
->setSubject('Welcome on board!')
->setTemplate('email/welcome.html.twig')
->setTemplate('email/'.$blockname.'.html.twig')
->setData(array(
'user' => $user
))
->renderView()
);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.