removeRecipient

The removeRecipient hook is triggered when a newsletter recipient is removed. It passes the email address and the channel IDs as argument and does not expect a return value.

Parameters

  1. string $email

    The recipient’s email address which has been removed.

  2. array $channels

    The channels from which the recipient has unsubscribed.

Example

// src/EventListener/RemoveRecipientListener.php
namespace App\EventListener;

use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;

#[AsHook('removeRecipient')]
class RemoveRecipientListener
{
    public function __invoke(string $email, array $channels): void
    {
        // Do something …
    }
}

References