PHP code example of markocupic / be_email

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

    

markocupic / be_email example snippets




namespace Vendorname\App\Listener\ContaoHooks;

use Contao\CoreBundle\ServiceAnnotation\Hook;

/**
 * @Hook("beEmailBeforeSendHook")
 */
class BeEmailBeforeSendHook
{
    /**
     * !!!Important
     * For manipulating data first and second parameter should be passed by reference!
     * @param $objEmail
     * @param $beEmailModel
     * @param $dc
     */
    public function __invoke(&$objEmail, &$beEmailModel, $dc)
    {
        // f.ex. manipulate sender email address
        $objEmail->from = '[email protected]';

        // f.ex. manipulate content
        $objEmail->text = 'bla bla!!';
        $objEmail->html = 'bla bla!!';
    }

}