<?php

namespace App\Providers;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\ServiceProvider;
use Illuminate\Mail\Events\MessageSending;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap any application services.
     */
   public function boot(): void
{
    Event::listen(MessageSending::class, function ($event) {

        $event->message->getHeaders()->addTextHeader(
            'List-Unsubscribe',
            '<mailto:bajas@tudominio.com>, <https://tudominio.com/unsubscribe>'
        );

        $event->message->getHeaders()->addTextHeader(
            'List-Unsubscribe-Post',
            'List-Unsubscribe=One-Click'
        );
    });
}
}
