getFromAddress(); $toEmail = $request->getToAddress(); $formContent = $request->getRawHtmlBody(); if (!$this->isFromLdc($fromEmail)) { $this->logger->warning( 'Received a brevo webhook call from a non ldc email.', [ 'from' => $fromEmail, 'to' => $toEmail, 'content' => base64_encode($formContent) ] ); return response()->json( ['ok' => false], Response::HTTP_BAD_REQUEST ); } $this->dispatcher->dispatch( new BrevoWebhookCallReceived( from: $fromEmail, to: $toEmail, htmlRawContent: $formContent, ) ); return response()->json(['ok' => true]); } private function isFromLdc(Email $email): bool { return substr(strrchr($email->value, "@"), 1) === 'ldc.fr'; } }