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\ServiceAnnotation\Hook;
use Terminal42\ServiceAnnotationBundle\ServiceAnnotationInterface;

class RemoveRecipientListener implements ServiceAnnotationInterface
{
    /**
     * @Hook("removeRecipient")
     */
    public function onRemoveRecipient(string $email, array $channels): void
    {
        // Do something …
    }
}

References