activateRecipient

The activateRecipient hook is triggered when a new newsletter recipient is added. It passes the e-mail address, the recipient IDs and the channel IDs as arguments and does not expect a return value.

Parameters

  1. string $email

    The newsletter recipient’s email address.

  2. array $recipientIds

    Array of recipient IDs for which this email address was used.

  3. array $channelIds

    Array of newsletter channel IDs for which this email address is subscribed to.

Example

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

use Contao\CoreBundle\ServiceAnnotation\Hook;

/**
 * @Hook("activateRecipient")
 */
class ActivateRecipientListener
{
    public function __invoke(string $email, array $recipientIds, array $channelIds): void
    {
        // Do something …
    }
}

References