spaceemotion / laravel-sparkpost-options
通过 X-MSYS-API 标头添加 SparkPost 选项的支持,即使在使用 API 实现时也不例外
1.1.1
2019-08-11 19:14 UTC
Requires
- php: ~5.6|~7.0
- guzzlehttp/guzzle: ^6.2
- illuminate/mail: ^5.1
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-12 06:40:10 UTC
README
此包添加了对添加 SparkPost 消息选项的支持。尽管 Laravel 允许设置全局选项,但此包通过 X-MSYS-API 标头添加了按消息选项的功能,即使在使用集成的“通过 API 发送”实现时也是如此。
SparkPost 选项文档: https://developers.sparkpost.com/api/smtp-api.html#header-using-the-x-msys-api-custom-header
安装
通过 Composer
$ composer require spaceemotion/laravel-sparkpost-options
5.4 及以下版本: 将 ServiceProvider 添加到您的 app.php
Spaceemotion\LaravelSparkPostOptions\SparkPostConfigProvider::class,
使用方法
您可以直接附加邮件头
$mailable->withSwiftMessage(function ($message) use ($options) { $message->getHeaders()->addTextHeader(SparkPostConfigProvider::CONFIG_HEADER, json_encode([ // Your options here... ])); });
或通过集成的 attach
方法
ConfigurableTransport::attach($mailable, [ // Your options here... ]);
许可证
MIT 许可证 (MIT)。请参阅 许可证文件 了解更多信息。