SparkPost Transaction Options #31
Description
I recently began testing SparkPost for transactional emails and noticed that it was rewriting all my URLs for click tracking and inserting a small image for open tracking. While I think that is fine for marketing / campaign emails, I'd rather have those features disabled for transactional emails.
To disable these features, you need to include an options
object in the JSON payload with the appropriate keys such as:
"options": {
"open_tracking": false,
"click_tracking": false,
"transactional": true
}
There isn't an easy way to do this — you must extend/override the send
method in SparkPostTransport. I propose adding an options
array to the sparkpost
service configuration.
'sparkpost' => [
'secret' => env('SPARKPOST_SECRET'),
'options' => [
'open_tracking' => false,
'click_tracking' => false,
'transactional' => true,
],
],
Maybe not adding this to the default services.php
config, but at least supporting it? I'd be happy to make this improvement and submit a pull request. I feel like most users will send transactional email from Laravel and may want to opt-out of these features as well. Thoughts?