Skip to content

jjaffeux/postmark-inbound-php

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

POSTMARK INBOUND HOOK

This is a simple API wrapper for Postmark Inbound Hook (http://developer.postmarkapp.com/developer-inbound-webhook.html)

Build Status

Setup

With composer :

{
    "require": {
        "jjaffeux/postmark-inbound-php": ">=3.0"
    }
}
$inbound = new \Postmark\Inbound(file_get_contents('php://input'));

Without composer :

require_once '../lib/Postmark/Autoloader.php';
\Postmark\Autoloader::register();

// this file should be the target of the callback you set in your postmark account
$inbound = new \Postmark\Inbound(file_get_contents('php://input'));

General Usage

$inbound->Subject();
$inbound->FromEmail();
$inbound->FromFull();
$inbound->FromName();
$inbound->Date();
$inbound->OriginalRecipient();
$inbound->ReplyTo();
$inbound->MailboxHash();
$inbound->Tag();
$inbound->MessageID();
$inbound->TextBody();
$inbound->HtmlBody();
$inbound->StrippedTextReply();

Headers

$inbound->Headers(); //default to spam status
$inbound->Headers('X-Spam-Status');
$inbound->Headers('X-Spam-Checker-Version');
$inbound->Headers('X-Spam-Score');
$inbound->Headers('X-Spam-Tests');
$inbound->Headers('Received-SPF');
$inbound->Headers('MIME-Version');
$inbound->Headers('Received-SPF'); // pass neutral fail
$inbound->Headers('Message-ID');

Recipients and Undisclosed Recipients

foreach($inbound->Recipients() as $recipient) {
	$recipient->Name;
	$recipient->Email;
}

foreach($inbound->UndisclosedRecipients() as $undisclosedRecipient) {
	$undisclosedRecipient->Name;
	$undisclosedRecipient->Email;
}

Attachments

foreach($inbound->Attachments() as $attachment) {
	$attachment->Name;
	$attachment->ContentType;
	$attachment->ContentLength;
	$attachment->Download('/'); //takes directory as first argument
}

$inbound->HasAttachments();

Raw

$inbound->Source; //array
$inbound->Json; //raw json

Bug tracker

Have a bug? Please create an issue here on GitHub!

Contributions

  • Fork
  • Write tests (phpunit in the directory to run the tests)
  • Write Code
  • Pull request

Thanks for your help.

Authors

Joffrey Jaffeux

Inspiration

Thx to Randy Schmidt for the original ruby wrapper

Other libraries

License

MIT License