PHP code example of ton / email-bundle

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

    

ton / email-bundle example snippets


use Ton\EmailBundle\EventListener\EmailListener;

    /**
     * @todo check multiple initialization
     */
    protected function registerEmailListener()
    {
        $container = $this->getContainer();
        $mailer = $container->get('mailer');
        $plugin = new EmailListener();
        $mailer->registerPlugin($plugin);
        return $plugin;
    }

    /**
     * @test
     */
    public function sendEmail()
    {
        $email = $this->registerEmailListener();
        $email->clean();

        // Send Email

        $this->assertCount(1, $email->getPreSendMessages());
        $email->getPreSendMessage(0);
    }