sendNewsletter
Details
This page shows version 4.x. The current version can be found here.
This hook is executed directly after Contao has sent a newsletter to its recipients.
Note
Using the sendNewsletter hook has been deprecated and will no longer work in Contao 5.0.
Use the SendNewsletterEvent instead.
Parameters
\Contao\Email
$emailThe
\Contao\Emailinstance of the newsletter.\Contao\Database\Result $newsletter
A
\Contao\Database\Resultinstance from thetl_newslettertable.array
$recipientAn associative array containing information about the recipient.
string
$textThe text-only content of the newsletter.
string
$htmlThe HTML content of the newsletter.
Example
// src/EventListener/SendNewsletterListener.php
namespace App\EventListener;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
use Contao\Database\Result;
use Contao\Email;
#[AsHook('sendNewsletter')]
class SendNewsletterListener
{
public function __invoke(Email $email, Result $newsletter, array $recipient, string $text, string $html): void
{
// Do something …
}
}