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.
string $email
The newsletter recipient’s email address.
array $recipientIds
Array of recipient IDs for which this email address was used.
array $channelIds
Array of newsletter channel IDs for which this email address is subscribed to.
// src/EventListener/ActivateRecipientListener.php
namespace App\EventListener;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
#[AsHook('activateRecipient')]
class ActivateRecipientListener
{
public function __invoke(string $email, array $recipientIds, array $channelIds): void
{
// Do something …
}
}