PHP Classes

File: docs.txt

Recommend this page to a friend!
  Classes of Warble   spamc   docs.txt   Download  
File: docs.txt
Role: Documentation
Content type: text/plain
Description: Documentation
Class: spamc
Test if a message is spam with SpamAssassin server
Author: By
Last change: Added description of error string, and filter return value. Also added link to Protocol description.
Date: 16 years ago
Size: 2,558 bytes
 

Contents

Class file image Download
== USAGE == Create instance: $filter = new spamc(); Configure client: $filter->host = 'localhost'; $filter->user = 'myspamuser'; $filter->command = 'REPORT' Filter data - The filter function will return true or false depending on whether the execution was successful. This does not indicate whether the filter determined if the data was spam or not. if (!$filter->filter($data_to_be_filtered)) { print_r($filter->err); } else { print_r($filter->result); } Configuration Vars: host - spamd hostname (default: localhost) port - spamd port (default: 783) timeout - network timeout. (default: 30seconds) user - spamassassin user command - type of request to make: CHECK -- Just check if the passed message is spam or not and reply as described below. Filter returns true/false based on server response. SYMBOLS -- Check if message is spam or not, and return score plus list of symbols hit. Filter returns true/false based on server response. REPORT -- Check if message is spam or not, and return score plus report Filter returns true/false based on server response. REPORT_IFSPAM -- Check if message is spam or not, and return score plus report if the message is spam. Filter returns true/false based on server response. SKIP -- For compatibility only. Always returns true. No reponse is provided. PING -- Return a confirmation that spamd is alive. Filter returns true/false based on server response. No filtering is done and no report is provided. PROCESS -- Process this message as described above and return modified message. Filter returns true/false based on server response. If successful, result of the filter is returned in the 'result' array. VERSION -- Server protocol version RESPONSE_CODE -- Response code. 0 is success, >0 is an error. RESPONSE_STRING -- Response string. EX_OK is success, otherwise error string is provided. CONTENT_LENGTH -- Size of data sent to server. (Only valid if command is PROCESS, otherwise 0) REPORT -- Report from server. This format depends on the command issue and may be empty. SPAM -- Bool, reports filter decision. (depends on command issued) SCORE -- reported spam score MAX -- Max spam score as configured on the server. If unsuccessful, the 'err' variable will contain error information. See http://spamassassin.apache.org/full/3.0.x/dist/spamd/PROTOCOL for details.