Location: PHPKode > scripts > Spam Rating > spam-rating/spamchk.php
@author -> Jijomon.T
@email  -> hide@address.com

		Hi All this is raw script to get the spam count in a message , you can modify this class to get a presentable result .


 Steps before running script

			# 1 Check Service Spamd is running on the server
			# 2 Cofigure local.cf file in /etc/mail/spamassassin/
			# Find Sample configuration below

			score  HTML_FONT_BIG 0.30
			score HTML_IMAGE_ONLY_20 0.10
			score HTML_IMAGE_ONLY_04 0.10
			score  HTML_IMAGE_ONLY_08 2.00
			score  HTML_IMAGE_ONLY_12 0.10
			score  HTML_IMAGE_ONLY_16 2.00
			score  HTML_IMAGE_ONLY_20 2.00
			score HTML_IMAGE_ONLY_24 0.10
			score HTML_IMAGE_RATIO_02 0.20 
			score MIME_HTML_MOSTLY 0.70
			score HTML_IMAGE_RATIO_04 0.20 
you can customize this based on your requirment

/*SPAM Count Class*/

	class spamcount
	var $fname;
	var $message;
	var $score;
		function  spamcount($message)
		/*  Create tempfile and store your html message here */
		$fname= tempnam("/tmp","sa"); 
		/* Put html message in to tempfile */
		//print $message;
		/* Execute the system command  and pass the file name to get spam count*/
		exec("/usr/bin/spamc -R < $fname",$score,$rr); 
		/*This will return score details in array format , you needs to manipulate this array to show in a webpage , use your coding expertise here :)*/


	 /* Execute Spam Count Functionality from here */
	 /*pass the html message here or pass the tempfilename(for this you needs to make some chnages in the class ) */
$htmlmessage='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta content="false" http-equiv="imagetoolbar">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
viagra test test
$spamcount = new spamcount($htmlmessage);
Return current item: Spam Rating