-
Notifications
You must be signed in to change notification settings - Fork 28
SparkPost Transaction Options #31
Comments
I think this would be easiest by going with what was suggested in #20 Allowing you to send mail via classes instead of the closure syntax would allow for maximum extensibility & overriding. |
@djtarazona agree so much with this and yes click tracking on transactional emails is in my opinion also not a good idea, for marking mails its ok, but not for transactional. How did you solve this now? Lately I've noticed e.g. on for example an account confirmation email with the token-link in there; that the "click tracking" is actually firing the links. Yes, you got it, Sparkposts services seems like they are actually checking if the links exists and in the process also fires of e.g. the new account confirmation link. I've litterly send of an email and saw the call came through a couple of seconds later...bit scary. Thus the users are getting confused that their accounts are verified automagically. We really need to be able to switch off the "click tracking" in an Laravel style and not have to extend and override classes etc. It is really a pitty that sparkpost doesn't allow it to be switched of via their web-portal... wonder why? |
@slakbal Ya, I don't know why SparkPost doesn't allow you to disable the click tracking at the account level. However, I made a PR for this and it was merged into Laravel v5.2.40 so you should be able to pass the appropriate options in your My 'sparkpost' => [
'secret' => env('SPARKPOST_SECRET'),
'options' => [
'open_tracking' => false,
'click_tracking' => false,
'transactional' => true,
],
], |
@djtarazona really!!! Let me try that out immediately! Thanks so much! |
@djtarazona this rocks thanks! Maybe we can get a PR on the laravel documentation for this? |
@djtarazona The options do not seem to be taken into account (Laravel v5.4.13). I have the options in my services.php file
But the email links are still visited by Sparkpost. I tried these options through Postman and it works (the link is not visited), here is my example :
Is it still working for you guys ? |
@mehdisbys based on 'sparkpost' => [
'secret' => env('SPARKPOST_SECRET'),
'options' => [
'options' => [
'open_tracking' => false,
'click_tracking' => false,
'transactional' => true,
]
],
], One |
We should probably get it changed from options -> settings in the config file to avoid confusion in the future. |
@KristofMorva thank you so much, your comment helped me to save my time. rergards. |
@tomschlick @KristofMorva @mehdisbys @a-ghasemi Looks like this behavior changed in 'sparkpost' => [
'secret' => env('SPARKPOST_SECRET'),
'options' => [
'options' => [
'open_tracking' => false,
'click_tracking' => false,
'transactional' => true,
]
],
], But rather: 'sparkpost' => [
'secret' => env('SPARKPOST_SECRET'),
'options' => [
'open_tracking' => false,
'click_tracking' => false,
'transactional' => true,
],
], I'd say this is a bug now. Ping @taylorotwell. I can submit a PR to fix unless Taylor wants to fix it real quick. |
For anybody else stumbling upon this: I had a very similar problem today, but wanted to set the options on a per-message basis. Searching only brought me to one laracasts thread (https://laracasts.com/discuss/channels/laravel/mailsend-passing-custom-parameters-for-sparkpost-api-call) where they eventually used the SMTP layer with a header in the end. I did not want to use that alternative and managed to add the functionality as a Laravel transport extension. As suggested by the thread here's a handy package out of my version: https://github.com/spaceemotion/laravel-sparkpost-options |
Did this get resolved? I am trying to use the Sparkpost Sandbox, and need to set the parameter in the options section and can't get anything to work. |
@WallyJ does my package not help you out? Not sure if it works with Laravel 6 though... |
I appreciate that you created a package, and I'm still on 5.8, btw. |
@WallyJ please try using the package and see if it works with it. I had the same experience, not even with just the sandbox (the X-MSYS-API header in general). There's some funky stuff going on under the hood which the solution I came up with tries to circumvent. While not the prettiest, it would at least confirm that it works and could be integrated into Laravel via a PR. |
So, if I download and try your package, what syntax would I use to add the sandbox option? |
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:There isn't an easy way to do this — you must extend/override the
send
method in SparkPostTransport. I propose adding anoptions
array to thesparkpost
service configuration.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?The text was updated successfully, but these errors were encountered: