By Simon Hampel
Standalone implementation of Symfony Mailer SparkPost Driver based on https://github.com/gam6itko/sparkpost-mailer - but using GuzzleHttp as the HTTP client rather than Symfony HTTP Client.
You can install the package via composer:
composer require hampel/symfonymailer-sparkpost
The SparkPost options available are defined in the API: SparkPost options
$sparkpostOptions = [
'options' => [
'open_tracking' => false,
'click_tracking' => true,
'transactional' => true,
],
];
$transport = new SparkPostApiTransport(
'MYSPARKPOSTAPIKEY',
new GuzzleHttp\Client
);
new SparkPostEmail();
$email->setOptions([
'click_tracking' => false,
'open_tracking' => true,
'transactional' => true,
]);
$email->setCampaignId('my-campaign');
$email->from('[email protected]');
$email->to('[email protected]');
$email->subject('My subject');
$email->text(...);
$email->html(...);
$result = $transport->send($email);