namespace App\Listeners;
use ag84ark\AwsSesBounceComplaintHandler\AwsSesBounceComplaintHandler;
use Illuminate\Mail\Events\MessageSending;
class CheckEmailAddressBeforeSending
{
public function __construct()
{
//
}
public function handle(MessageSending $event): bool
{
$email = $event->data['email'];
if (!AwsSesBounceComplaintHandler::canSendToEmail($email)) {
\Log::info(json_encode($event->data));
// log the information in some way
return false;
}
return true;
}
}