sendNewsletter

This hook is executed directly after Contao has sent a newsletter to its recipients.

Parameters

  1. \Contao\Email $email

    The \Contao\Email instance of the newsletter.

  2. \Contao\Database\Result $newsletter

    A \Contao\Database\Result instance from the tl_newsletter table.

  3. array $recipient

    An associative array containing information about the recipient.

  4. string $text

    The text-only content of the newsletter.

  5. string $html

    The HTML content of the newsletter.

Example

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

use Contao\CoreBundle\ServiceAnnotation\Hook;
use Contao\Email;
use Terminal42\ServiceAnnotationBundle\ServiceAnnotationInterface;

class SendNewsletterListener implements ServiceAnnotationInterface
{
    /**
     * @Hook("sendNewsletter")
     */
    public function onSendNewsletter(Email $email, \Contao\Database\Result $newsletter, array $recipient, string $text, string $html): void
    {
        // Do something …
    }
}

References