<commit_before>POSTMARK INBOUND HOOK
=====================

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

[![Build Status](https://secure.travis-ci.org/jjaffeux/postmark-inbound-php.png?branch=master)](http://travis-ci.org/jjaffeux/postmark-inbound-php)


Setup
-----

``` php
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
-------------

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

Headers
-------

``` php
$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');
$inbound->Headers('Message-ID');
``` 


Recipients and Undisclosed Recipients
-------------------------------------

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

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

Attachments
-------------------------------------

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

$inbound->HasAttachments();
``` 


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
-------

**<NAME>**

+ http://twitter.com/joffreyjaffeux
+ http://github.com/jjaffeux

Inspiration
-----------

Thx to Randy Schmidt for the original ruby wrapper

+ https://github.com/r38y
+ http://forge38.com/


Other libraries
---------------

+ Ruby : https://github.com/r38y/postmark-mitt
+ Python : https://github.com/jpadilla/postmark-inbound-python
+ Node : https://gist.github.com/1647808


License
---------------------

MIT License<commit_msg>setup intructions for composer<commit_after>POSTMARK INBOUND HOOK
=====================

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

[![Build Status](https://secure.travis-ci.org/jjaffeux/postmark-inbound-php.png?branch=master)](http://travis-ci.org/jjaffeux/postmark-inbound-php)


Setup
-----
With composer :
``` json
{
    "require": {
        "jjaffeux/postmark-inbound-php": "2.0.*"
    }
}
``` 

Without composer :
``` php
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
-------------

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

Headers
-------

``` php
$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');
$inbound->Headers('Message-ID');
``` 


Recipients and Undisclosed Recipients
-------------------------------------

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

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

Attachments
-------------------------------------

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

$inbound->HasAttachments();
``` 


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
-------

**<NAME>**

+ http://twitter.com/joffreyjaffeux
+ http://github.com/jjaffeux

Inspiration
-----------

Thx to <NAME> for the original ruby wrapper

+ https://github.com/r38y
+ http://forge38.com/


Other libraries
---------------

+ Ruby : https://github.com/r38y/postmark-mitt
+ Python : https://github.com/jpadilla/postmark-inbound-python
+ Node : https://gist.github.com/1647808


License
---------------------

MIT License
{'fraction_non_alphanumeric': 0.23624161073825503, 'fraction_numerical': 0.005369127516778523, 'mean_word_length': 3.5475152571926767, 'pattern_counts': {'":': 2, '<': 6, '<?xml version=': 0, '>': 72, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3557651', 'n_tokens_mistral': 1789, 'n_tokens_neox': 1674, 'n_words': 325}