jjaffeux/postmark-inbound-php

Postmark Inbound PHP 封装器

3.0.1 2015-09-21 12:48 UTC

This package is not auto-updated.

Last update: 2024-09-14 12:53:01 UTC


README

这是一个简单的 Postmark Inbound Hook (http://developer.postmarkapp.com/developer-inbound-webhook.html) API 封装器

Build Status

安装

使用 composer

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

不使用 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'));

通用用法

$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();

头部信息

$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');

收件人和未公开收件人

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

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

附件

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

$inbound->HasAttachments();

原始内容

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

错误追踪器

有错误?请在 GitHub 上创建一个问题!

贡献

  • 分支
  • 编写测试(在目录中运行测试的 phpunit)
  • 编写代码
  • 拉取请求

感谢您的帮助。

作者

Joffrey Jaffeux

灵感来源

感谢 Randy Schmidt 提供原始的 Ruby 封装器

其他库

许可证

MIT 许可证