PHP class to test an email via the postmark's spamcheck webservice
PHP
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Postmark
README.md
example.php

README.md

PHP class to use Postmark Spamcheck webservice

Documentation of the webservice can be found here.

Requirements

  • This class relies on the Zend Framework classes Zend_Http_Client / Zend_Http_Response

Example usage

<?php
	require_once "Postmark/SpamCheck.php";

	$RawEmail = <<<EOT
	Here come the raw email, including headers
	EOT;

	$SpamCheck = new Postmark_SpamCheck();

	$Response = $SpamCheck->setMode("long")->setRawEmail($RawEmail)->check();

	print "Total score: {$Response->score} points\n";

	foreach( $Response->ReportArray as $ReportLine ) {
		print "- Rule {$ReportLine->rule_name} matches with {$ReportLine->points} points\n";
	}
	
	/*
	Total score: 7.9 points
	- Rule NO_RELAYS matches with -0 points
	- Rule MISSING_HEADERS matches with 1.2 points
	- Rule MISSING_MID matches with 0.1 points
	- Rule MISSING_SUBJECT matches with 1.8 points
	- Rule EMPTY_MESSAGE matches with 2.3 points
	- Rule MISSING_FROM matches with 1 points
	- Rule NO_RECEIVED matches with -0 points
	- Rule MISSING_DATE matches with 1.4 points
	- Rule NO_HEADERS_MESSAGE matches with 0 points
	*/