PHP code example of hampel / symfonymailer-sparkpost
1. Go to this page and download the library: Download hampel/symfonymailer-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 / symfonymailer-sparkpost example snippets
$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);