spaceemotion / laravel-sparkpost-options
Adds support for adding SparkPost options via the X-MSYS-API header, even when using the API implementation
Fund package maintenance!
Ko Fi
Installs: 1 304
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- php: ~5.6|~7.0
- guzzlehttp/guzzle: ^6.2
- illuminate/mail: ^5.1
Requires (Dev)
This package is auto-updated.
Last update: 2024-11-12 06:59:05 UTC
README
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
$ composer require spaceemotion/laravel-sparkpost-options
5.4 and below: Add the ServiceProvider to your app.php
:
Spaceemotion\LaravelSparkPostOptions\SparkPostConfigProvider::class,
Usage
You can either attach the mail header directly:
$mailable->withSwiftMessage(function ($message) use ($options) { $message->getHeaders()->addTextHeader(SparkPostConfigProvider::CONFIG_HEADER, json_encode([ // Your options here... ])); });
or via the integrated attach
method:
ConfigurableTransport::attach($mailable, [ // Your options here... ]);
License
The MIT License (MIT). Please see License File for more information.