PHP code example of samdeb / easymailbundle

1. Go to this page and download the library: Download samdeb/easymailbundle 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/ */

    

samdeb / easymailbundle example snippets


// ABC\EasyMailBundle\Controller\DefaultController.php

class DefaultController extends Controller
{
    public function indexAction()
    {
        $mail = $this->get('easy.mailer');
        $settings = array(
                          'to'=>'[email protected]',
                          'subject' => 'This is my subject',
                          'body'    => array(
                                        'content' => 'Put your text',
                                    )
                    );
        $mail->send($settings);
        return $this->render('ABCEasyMailBundle:Default:index.html.twig');
    }
}

// ABC\EasyMailBundle\Controller\DefaultController.php

class DefaultController extends Controller
{
    public function indexAction()
    {
        $mail = $this->get('easy.mailer');
        $settings = array('default_theme'=>'other',
                          'to'=>'[email protected]',
                          /*
                          'cc'=>'[email protected]',
                          'bcc'=> '[email protected]',
                          */
                          'subject' => 'This is my subject',
                          'body'    => array(
                                        /*
                                         'logo'   => 'Mylogo.jpg',
                                         'title'  => 'Diferent Company Name',
                                         */
                                        'content' => 'Put your text',
                                        'footer'  => 'Saludos'
                                    )
                    );
        $mail->send($settings);
        return $this->render('ABCEasyMailBundle:Default:index.html.twig');
    }
}
 php
//app/AppKernel.php
//...
    public function registerBundles()
    {
        $bundles = array(
            //Other bundles
            new ABC\EasyMailBundle\ABCEasyMailBundle(),
        );