lundi 17 janvier 2022

Laravel 5.8 sending email & blacklist

I am trying to make a blacklist for emails and I want to implement it upon every every email sending so I would check if users email is blacklisted or not.

At the moment I have.

use Illuminate\Support\Facades\Mail;
if(!EmailExceptionList::isMailBlacklisted($email))
{
    Mail::to($email)->send(new NewViewEmail($user));
}

Now the problem is that I'd have to manually do this everytime - call this function at every place where I have this, is there a way to extend the native laravel mail function and do something like this? Like we have middlewares but for something like this?

I thought about writting a fascade and then simply adding this but still that would take me a bit of time and in the future I'd have to call it and also fascade for a fascade..



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3qAB1a9
via IFTTT

Aucun commentaire:

Enregistrer un commentaire