PHP code example of terehinis / mandrill-bundle

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

    

terehinis / mandrill-bundle example snippets





// src/Slot/ExampleBundle/Controller/ExampleController.php
namespace Slot\ExampleBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Slot\MandrillBundle\Message;
use Slot\MandrillBundle\Dispatcher;

class ExampleController extends Controller
{
    public function indexAction()
    {
        $dispatcher = $this->get('slot_mandrill.dispatcher');

        $message = new Message();

        $message
            ->setFromEmail('[email protected]')
            ->setFromName('Customer Care')
            ->addTo('[email protected]')
            ->setSubject('Some Subject')
            ->setHtml('<html><body><h1>Some Content</h1></body></html>')
            ->setSubaccount('Project');

        $result = $dispatcher->send($message);

        return new Response('<pre>' . print_r($result, true) . '</pre>');

    }

}

sh
php ./composer.phar install