PHP code example of hampel / swiftmailer-sparkpost

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

    

hampel / swiftmailer-sparkpost example snippets



$sparkpostOptions = [
	'options' => [
		'open_tracking' => false,
		'click_tracking' => true,
		'transactional' => true,
	],
	'campaign_id' => 'foo',
];

$transport = new SparkPostTransport(
	new GuzzleHttp\Client, 
	'MYSPARKPOSTAPIKEY', 
	$sparkpostOptions
);

// create a new Swift_Message
$message = ...

$result = $transport->send($message);