Closed bretto36 closed 9 months ago
Right now there's not a way to prevent an email from storing the sent email. You might be able to do something by extending the MailTrackerServiceProvider and changing the logic for hooking into the mailer events to be more selective on what calls the messageSending()
and messageSent()
functions.
@jdavidbakr sorry after looking into the code looks like putting a header in 'X-No-Track' will stop it from storing the email for the first recipient/sender... but if the email has multiple recipients it will store subsequent ones. Is this intentional or in error, i am happy to put a PR in if specifying the X-No-Track header means it should never track it at all
For anyone else who finds this, laravel has a header method you can put on your Mailable. I'm going to make an UntrackedTrait and add that to all the emails i dont need to track.
public function headers(): Headers { return new Headers( text: [ 'X-No-Track' => true, ], ); }
Feel free to submit a PR, please be sure to include appropriate tests.
@jdavidbakr will do, just wanted to be sure if it was intentional or not. As always thanks for maintaining a great useful package. I'll put in a PR sometime today
I've been using this package for a few years and our sent emails table has got quite large, We need to keep the content for emails for 7 years, but only for SOME emails. Other emails i do not need to track at all.
I'd love to be able to skip these emails if possible.
Is there a way to do that currently?