PHP code example of cnerta / mailing-bundle

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

    

cnerta / mailing-bundle example snippets


use Cnerta\MailingBundle\Mailing\MailingServiceInterface;
use Cnerta\MailingBundle\Mailing\MailParameters;
use Cnerta\MailingBundle\Mailing\MailParametersInterface;

[...]
public function fooAction() {
    $mailParameters = MailParameters();

    $mailParameters
            ->setTemplateBundle('MyBundle')
            ->addBodyParameters("user", "User name");

    $this->get('cnerta.mailing')
        ->sendEmail(
            array("[email protected]"), // List of mail address or Symfony\Component\Security\Core\User\UserInterface
            "template_email", // Name of the block define in `BlocksMail.html.twig`
            $mailParameters);
}
 php

// app/AppKernel.php

    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Cnerta\MailingBundle\CnertaMailingBundle(),
        );

        // ...
    }

    // ...