Skip to content

Latest commit

 

History

History
58 lines (43 loc) · 1.81 KB

README.md

File metadata and controls

58 lines (43 loc) · 1.81 KB

Symfony Mailer SparkPost Driver

Latest Version on Packagist Total Downloads Open Issues License

By Simon Hampel

Description

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.

Installation

You can install the package via composer:

composer require hampel/symfonymailer-sparkpost

Usage

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);