https://github.com/spaceemotion/laravel-sparkpost-options
Adds support for adding SparkPost options via the X-MSYS-API header, even when using the API implementation. Update-PRs welcome! ⚠
https://github.com/spaceemotion/laravel-sparkpost-options
laravel mail php smtp sparkpost
Last synced: 9 months ago
JSON representation
Adds support for adding SparkPost options via the X-MSYS-API header, even when using the API implementation. Update-PRs welcome! ⚠
- Host: GitHub
- URL: https://github.com/spaceemotion/laravel-sparkpost-options
- Owner: spaceemotion
- License: mit
- Created: 2018-01-21T21:35:58.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-08-11T19:15:38.000Z (almost 7 years ago)
- Last Synced: 2025-04-02T13:00:00.463Z (over 1 year ago)
- Topics: laravel, mail, php, smtp, sparkpost
- Language: PHP
- Homepage:
- Size: 5.86 KB
- Stars: 6
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# laravel-sparkpost-options
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE.md)
[![Total Downloads][ico-downloads]][link-downloads]
This package adds support for adding SparkPost messaging options. Even though Laravel allows to set global options,
this package adds the functionality for per-message options via the X-MSYS-API header, even when using the
integrated "send via API" implementation.
**SparkPost Options documentation:**
https://developers.sparkpost.com/api/smtp-api.html#header-using-the-x-msys-api-custom-header
## Install
Via Composer
``` bash
$ composer require spaceemotion/laravel-sparkpost-options
```
**5.4 and below:** Add the ServiceProvider to your `app.php`:
```php
Spaceemotion\LaravelSparkPostOptions\SparkPostConfigProvider::class,
```
## Usage
You can either attach the mail header directly:
```php
$mailable->withSwiftMessage(function ($message) use ($options) {
$message->getHeaders()->addTextHeader(SparkPostConfigProvider::CONFIG_HEADER, json_encode([
// Your options here...
]));
});
```
or via the integrated `attach` method:
```php
ConfigurableTransport::attach($mailable, [
// Your options here...
]);
```
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
[ico-version]: https://img.shields.io/packagist/v/spaceemotion/laravel-sparkpost-options.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/spaceemotion/laravel-sparkpost-options.svg?style=flat-square
[link-packagist]: https://packagist.org/packages/spaceemotion/laravel-sparkpost-options
[link-downloads]: https://packagist.org/packages/spaceemotion/laravel-sparkpost-options
[link-author]: https://github.com/spaceemotion