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.
string $email
The recipient’s email address which has been removed.
array $channels
The channels from which the recipient has unsubscribed.
// 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 …
}
}