priyolahiri / postmark-inbound-php
Postmark Inbound PHP 包装器
3.0.0
2013-04-03 10:05 UTC
Requires
- php: >=5.2
This package is not auto-updated.
Last update: 2024-09-14 13:53:03 UTC
README
这是一个简单的 Postmark Inbound Hook API 包装器(http://developer.postmarkapp.com/developer-inbound.html)
设置
使用 composer
{ "require": { "jjaffeux/postmark-inbound-php": ">=2.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->ReplyTo(); $inbound->MailboxHash(); $inbound->Tag(); $inbound->MessageID(); $inbound->TextBody(); $inbound->HtmlBody();
头部信息
$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 上创建一个 issue!
贡献
- 分支
- 编写测试(phpunit 在目录中运行测试)
- 编写代码
- 拉取请求
感谢您的帮助。
作者
Joffrey Jaffeux
灵感来源
感谢 Randy Schmidt 提供原始的 Ruby 包装器
其他库
- Ruby : https://github.com/r38y/postmark-mitt
- Python : https://github.com/jpadilla/postmark-inbound-python
- Node : https://gist.github.com/1647808
许可
MIT 许可证