PHP code example of vemcogroup / laravel-sparkpost-driver

1. Go to this page and download the library: Download vemcogroup/laravel-sparkpost-driver 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/ */

    

vemcogroup / laravel-sparkpost-driver example snippets


'sparkpost' => [
    'secret' => env('SPARKPOST_SECRET')
],

'sparkpost' => [
    'secret' => env('SPARKPOST_SECRET'),

    // optional guzzle specific configuration
    'guzzle' => [
        'verify' => true,
        'decode_content' => true,
        ...
    ],
    'options' => [
        // configure endpoint, if not default
        'endpoint' => env('SPARKPOST_ENDPOINT'),

        // optional Sparkpost API options go here
        'return_path' => '[email protected]',
        'options' => [
            'open_tracking' => false,
            'click_tracking' => false,
            'transactional' => true,
        ],
    ],
],

SPARKPOST_SECRET=__Your_key_here__

MAIL_MAILER=sparkpost

'driver' => env('MAIL_MAILER', 'sparkpost'),

'mailers' => [
    ...
    'sparkpost' => [
        'transport' => 'sparkpost'
    ],
    ...
],

sparkpost_delete_supression('[email protected]');

sparkpost_check_email('[email protected]');

$subaccount_id = 1234;
$this->withSymfonyMessage(function ($message) use ($subaccount_id) { // 'this' is a mailable
    $headers = $message->getHeaders();
    $headers->addTextHeader('subaccount_id', $subaccount_id);
});