1. Go to this page and download the library: Download happyr/mailer-bundle 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/ */
happyr / mailer-bundle example snippets
// in AppKernel::registerBundles()
$bundles = array(
// ...
new Happyr\MailerBundle\HappyrMailerBundle(),
// ...
);
php
// AnyController.php
public function anyAction(){
$mailer=$this->get('happyr.mailer');
$mailer->send('[email protected]','AnyBundle:Email:test.html.twig');
}
php
$this->send($mail, $template, array('user'=>$user, 'attachments'=>
array(
//two attachments. You must specify either 'data' or 'path'
array(
'data'=>$bindaryPdf,
'contentType'=>'application/pdf',
'filename'=>'Invoice.pdf',
),
array(
'path'=>$pathToPdf,
'contentType'=>'application/pdf',
'filename'=>'Welcome.pdf',
),
)));