From e7777eeffe942be70b9ce1b04b152ad540cb59ae Mon Sep 17 00:00:00 2001 From: Lukas <42625423+lrakauskas@users.noreply.github.com> Date: Tue, 19 Sep 2023 11:07:51 +0100 Subject: [PATCH] Update README.md Listener sample code updated to work with HeaderInterface --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 810f0a1..9df5421 100644 --- a/README.md +++ b/README.md @@ -176,11 +176,9 @@ class MessageSentListener public function handle(MessageSent $event) { $headers = $event->message->getHeaders(); - $postalmessageid = $headers->get('Postal-Message-ID'); - $postalmessageid = explode(': ', $postalmessageid); - $postalmessageid = (count($postalmessageid) == 1) ? '' : trim($postalmessageid[1]); + $postalmessageid = $headers->get('postal-message-id')?->getBodyAsString(); - if (strlen($postalmessageid) > 0) { + if ($postalmessageid) { // do something here } }