PHP code example of slot / mandrill-bundle

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

    

slot / 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>');

    }

}