diff --git a/src/Symfony/Component/Mailer/Bridge/Mailgun/RemoteEvent/MailgunPayloadConverter.php b/src/Symfony/Component/Mailer/Bridge/Mailgun/RemoteEvent/MailgunPayloadConverter.php index 02e04104ac6b9..68dc6e96ca267 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailgun/RemoteEvent/MailgunPayloadConverter.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailgun/RemoteEvent/MailgunPayloadConverter.php @@ -55,8 +55,8 @@ public function convert(array $payload): AbstractMailerEvent } $event->setDate($date); $event->setRecipientEmail($payload['recipient']); - $event->setMetadata($payload['user-variables']); - $event->setTags($payload['tags']); + $event->setMetadata($payload['user-variables'] ?? []); + $event->setTags($payload['tags'] ?? []); return $event; } @@ -78,10 +78,10 @@ private function getReason(array $payload): string if ('' !== ($payload['delivery-status']['description'] ?? '')) { return $payload['delivery-status']['description']; } - if ('' !== $payload['delivery-status']['message']) { + if ('' !== ($payload['delivery-status']['message'] ?? '')) { return $payload['delivery-status']['message']; } - if ('' !== $payload['reason']) { + if ('' !== ($payload['reason'] ?? '')) { return $payload['reason']; } diff --git a/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Webhook/Fixtures/accepted.json b/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Webhook/Fixtures/accepted.json new file mode 100644 index 0000000000000..d349f3f331f54 --- /dev/null +++ b/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Webhook/Fixtures/accepted.json @@ -0,0 +1,39 @@ +{ + "signature":{ + "token": "885894756b6c371a377f5f9516d60a4db497ad27d4931ed215", + "timestamp": "1661621710", + "signature": "606307bb55b72686b1b2a2c8c37ae6e6ec89496592bac4a4eee5a346337d04a5" + }, + "event-data":{ + "event":"accepted", + "id":"4o7-z86dSkSI54c6IudeuA", + "timestamp":1707402341.91242, + "api-key-id":"##REDACTED##", + "envelope":{ + "sender":"postmaster@mg.herehaveth.is", + "targets":"ben@##REDACTED##", + "transport":"smtp" + }, + "flags":{ + "is-authenticated":true, + "is-test-mode":false + }, + "message":{ + "headers":{ + "message-id":"##REDACTED##", + "from":"\"Here, have this\" ", + "to":"alice@example.com", + "subject":"Please verify your email address." + }, + "size":2411 + }, + "storage":{ + "key":"##REDACTED##", + "url":"https:\/\/storage-us-east4.api.mailgun.net\/v3\/domains\/##REDACTED##" + }, + "method":"HTTP", + "log-level":"info", + "recipient":"alice@example.com", + "recipient-domain":"example.com" + } +} diff --git a/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Webhook/Fixtures/accepted.php b/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Webhook/Fixtures/accepted.php new file mode 100644 index 0000000000000..abe8e3d5af301 --- /dev/null +++ b/src/Symfony/Component/Mailer/Bridge/Mailgun/Tests/Webhook/Fixtures/accepted.php @@ -0,0 +1,9 @@ +setRecipientEmail('alice@example.com'); +$wh->setDate(\DateTimeImmutable::createFromFormat('U.u', '1707402341.91242')); + +return $wh; diff --git a/src/Symfony/Component/Mailer/Bridge/Mailgun/Webhook/MailgunRequestParser.php b/src/Symfony/Component/Mailer/Bridge/Mailgun/Webhook/MailgunRequestParser.php index b6ed83bc0ccbc..1a38b33bf8114 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailgun/Webhook/MailgunRequestParser.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailgun/Webhook/MailgunRequestParser.php @@ -50,8 +50,6 @@ protected function doParse(Request $request, #[\SensitiveParameter] string $secr || !isset($content['signature']['token']) || !isset($content['signature']['signature']) || !isset($content['event-data']['event']) - || !isset($content['event-data']['tags']) - || !isset($content['event-data']['user-variables']) ) { throw new RejectWebhookException(406, 'Payload is malformed.'); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy