PHP code example of twenty20 / mailer

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

    

twenty20 / mailer example snippets


protected $listen = [
    EmailBounced::class => [
        EmailBouncedListener::class,
    ],
    EmailDelivered::class => [
        EmailDeliveredListener::class,
    ],
    EmailDeferred::class => [
        EmailDeferredListener::class,
    ],
    ....
];

public function boot(): void
{
    Event::listen(
        EmailBounced::class,
        EmailBouncedListener::class,
    );
    Event::listen(
        EmailDelivered::class,
        EmailDeliveredListener::class,
    );
    Event::listen(
        EmailDeferred::class,
        EmailDeferredListener::class
    );
    ....
}

protected $except = [
    'mailer/*',
];

->withMiddleware(function (Middleware $middleware) {
    $middleware->validateCsrfTokens(except: [
        'mailer/*',
    ]);
})->withExceptions(function (Exceptions $exceptions) {
    //
})->create();
bash
php artisan mailer:install