API to process Postmark Inbound Webhooks.

v2.3.10 2020-09-11 03:28 UTC


Postmark Inbound


Latest Version on Packagist Software License Tests StyleCI Total Downloads

Simple API to process Postmark Inbound Webhooks.


You can install the package via composer:

composer require mvdnbrk/postmark-inbound


$inbound = new \Mvdnbrk\Postmark\InboundMessage(file_get_contents('php://input'));

$inbound->from->name;                   // John Doe
$inbound->from->email;                  //
$inbound->from->full;                   // John Doe <>

$inbound->messageId;                    // MessageID assigned by Postmark.
$inbound->messageIdFromHeaders;         // Message-ID value from headers.

$inbound->originalDate;                 // Wed, 6 Sep 2017 12:00:00 +0200
$inbound->date;                         // PostmarkDate::class which is an extension of the DateTime::class
$inbound->date->format('Y-m-d H:i:s')   // 2017-09-06 12:00:00
$inbound->date->isUtc                   // boolean, is the date in the UTC timezone?
$inbound->date->timezone;               // +02:00
$inbound->date->inUtcTimezone()         // Sets the timezone to UTC.
$inbound->subject;                      // Subject of the message.

$inbound->isSpam;                       // boolean, is the message to be considered as spam?
$inbound->spamStatus;                   // Spam status, defaults to 'No' when not present.
$inbound->spamScore;                    // float, defaults to 0.0 when not present.

$inbound->to->count()                   // Recipient count.

$inbound->attachments->count()          // Attachment count.

$inbound->headers->count()              // Header count.


$inbound->to->each(function($contact) {

$inbound->cc->each(function($contact) {

$inbound->bcc->each(function($contact) {

Get the first recipient:



$inbound->attachments->each(function($attachment) {
    $attachment->content();         // Base64 decoded data

Get the first attachment:


Get the last attachment:



The Message-ID in the headers are sometimes keyed with upper ID and sometimes they are in the format of Id. So if you want to get the Message-ID from a message you can simply use the $inbound->messageIdFromHeaders helper attribute. Please note that $inbound->messageId will give you the id of the message that was assigned by Postmark.

$inbound->headers->each(function($value, $key) {


Change log

Please see CHANGELOG for more information on what has changed recently.


Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.



The MIT License (MIT). Please see License File for more information.