sendNewsletter
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
$email
The
\Contao\Email
instance of the newsletter.\Contao\Database\Result $newsletter
A
\Contao\Database\Result
instance from thetl_newsletter
table.array
$recipient
An associative array containing information about the recipient.
string
$text
The text-only content of the newsletter.
string
$html
The 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 …
}
}