PHP code example of stof / stampie-extra

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

    

stof / stampie-extra example snippets




// include the Composer autoloading
ient();
$innerMailer = new Stampie\Mailer\SendGrid($httpClient, 'username:password');

$dispatcher = new Symfony\Component\EventDispatcher\EventDispatcher();
$mailer = new Stampie\Extra\Mailer($innerMailer, $dispatcher);

$message = // Create your Stampie message

$mailer->send($message);


$dispatcher->addEventSubscriber(new Stampie\Extra\EventListener\ImpersonateListener('[email protected]'));


// create a listener and configure it
$logger = new Monolog\Logger('stampie');
// ...

$dispatcher->addEventSubscriber(new Stampie\Extra\EventListener\LoggerListener($logger));



$mailer = // Create your mailer...
$spoolMailer = new Stampie\Extra\SpoolMailer($mailer);

$message = // Create your Stampie message...
$spoolMailer->send($message);

// Do some logic, for instance flushing the response to the user

// Flush the queue, sending the message with the inner mailer
$spoolMailer->flushSpool();