PHP code example of cspoo / swiftmailer-mailgun-bundle

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

    

cspoo / swiftmailer-mailgun-bundle example snippets


new cspoo\Swiftmailer\MailgunBundle\cspooSwiftmailerMailgunBundle(),

// config/bundles.php
return [
    ...
    cspoo\Swiftmailer\MailgunBundle\cspooSwiftmailerMailgunBundle::class => ['all' => true],
    ];

$message = \Swift_Message::newInstance()
        ->setSubject('Hello Email')
        ->setFrom('[email protected]')
        ->setTo('[email protected]')
        ->setBody(
            $this->renderView(
                'HelloBundle:Hello:email.txt.twig',
                array('name' => $name)
            )
        )
    ;

$this->container->get('mailer')->send($message);