Replace API_KEY with your Resend API key, and SIGNING_SECRET with your webhook secret, which can be retrieved from the Resend dashboard after creating a new webhook endpoint (see below).
Thanks to the Webhook Component, you can create a webhook listener.
src/Webhook/ResendWebhookListener.php
Copy
Ask AI
#[AsRemoteEventConsumer('mailer_resend')]readonly class ResendWebhookListener implements ConsumerInterface{ public function __construct( #[Autowire(param: 'kernel.project_dir')] private string $projectDir, ) { } public function consume(RemoteEvent $event): void { if ($event instanceof MailerDeliveryEvent) { $this->handleMailDelivery($event); } elseif ($event instanceof MailerEngagementEvent) { $this->handleMailEngagement($event); } else { // This is not an email event return; } } private function handleMailDelivery(MailerDeliveryEvent $event): void { // Todo } private function handleMailEngagement(MailerEngagementEvent $event): void { // Todo }}