Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hampel/symfonymailer-sparkpost
https://github.com/hampel/symfonymailer-sparkpost
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/hampel/symfonymailer-sparkpost
- Owner: hampel
- License: mit
- Created: 2024-08-09T10:37:00.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2024-10-04T12:05:06.000Z (3 months ago)
- Last Synced: 2024-11-11T15:47:09.923Z (about 1 month ago)
- Language: PHP
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Symfony Mailer SparkPost Driver
[![Latest Version on Packagist](https://img.shields.io/packagist/v/hampel/symfonymailer-sparkpost.svg?style=flat-square)](https://packagist.org/packages/hampel/symfonymailer-sparkpost)
[![Total Downloads](https://img.shields.io/packagist/dt/hampel/symfonymailer-sparkpost.svg?style=flat-square)](https://packagist.org/packages/hampel/symfonymailer-sparkpost)
[![Open Issues](https://img.shields.io/github/issues-raw/hampel/symfonymailer-sparkpost.svg?style=flat-square)](https://github.com/hampel/symfonymailer-sparkpost/issues)
[![License](https://img.shields.io/packagist/l/hampel/symfonymailer-sparkpost.svg?style=flat-square)](https://packagist.org/packages/hampel/symfonymailer-sparkpost)By [Simon Hampel](mailto:[email protected])
## 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:
```bash
composer require hampel/symfonymailer-sparkpost
```## Usage
The SparkPost options available are defined in the API:
[SparkPost options](https://developers.sparkpost.com/api/transmissions/#header-request-body)```php
$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);
```