SpamAssassin_Client
[ class tree: SpamAssassin_Client ] [ index: SpamAssassin_Client ] [ all elements ]

Class: SpamAssassin_Client

Source Location: /Client.php

Class Overview




Author(s):

Variables

Constants

Methods



Class Details

[line 12]


Tags:

author:  Pedro Padron <ppadron@w3p.com.br>
license:  Apache License 2.0


[ Top ]


Class Variables

$hostname =

[line 24]



Tags:

access:  protected

Type:   mixed


[ Top ]

$learnTypes = array(
        self::LEARN_SPAM,
        self::LEARN_HAM,
        self::LEARN_FORGET
    )

[line 18]



Tags:

access:  protected

Type:   mixed


[ Top ]

$port =

[line 25]



Tags:

access:  protected

Type:   mixed


[ Top ]

$protocolVersion =  1.5

[line 28]



Tags:

access:  protected

Type:   mixed


[ Top ]

$socket =

[line 27]



Tags:

access:  protected

Type:   mixed


[ Top ]

$socketPath =

[line 26]



Tags:

access:  protected

Type:   mixed


[ Top ]



Class Methods


constructor __construct [line 42]

SpamAssassin_Client __construct( $params)

Class constructor

Accepts an associative array with the following keys:

socketPath - mandatory only if using UNIX sockets to local server hostname - mandatory only if using remote SpamAssassin server user - optional parameter protocolVersion - spamd protocol version (defaults to 1.5)




Tags:

access:  public


Parameters:

array   $params   SpamAssassin parameters

[ Top ]

method check [line 321]

SpamAssassin_Client_Result check( string $message)

Checks if a message is spam with the CHECK protocol command



Tags:

return:  Object containing the result
access:  public


Parameters:

string   $message   Raw email message

[ Top ]

method exec [line 91]

void exec( string $cmd, string $message, [ $additionalHeaders = array()])

Sends a command to the server and returns an object with the result



Tags:

access:  protected


Parameters:

string   $cmd   Protocol command to be executed
string   $message   Full email message
array   $additionalHeaders   Associative array with additional headers

[ Top ]

method getSocket [line 63]

void getSocket( )

Creates a new socket connection with data provided in the constructor



Tags:

access:  protected


[ Top ]

method getSpamReport [line 287]

string getSpamReport( string $message)

Returns a detailed report if the message is spam or null if it's ham



Tags:

return:  Detailed spam report
access:  public


Parameters:

string   $message   Email message

[ Top ]

method headers [line 309]

SpamAssassin_Client_Result headers( string $message)

Processes the message and returns it's headers

This will check if the message is spam or not and return all headers for the modified processed message. Such as X-Spam-Flag and X-Spam-Status.




Tags:

return:  Object containing the
access:  public


Parameters:

string   $message   Headers for the modified message

[ Top ]

method isSpam [line 333]

boolean isSpam( string $message)

Shortcut to check() method that returns a boolean



Tags:

return:  Whether message is spam or not
access:  public


Parameters:

string   $message   Raw email message

[ Top ]

method learn [line 378]

boolean learn( string $message, [int $learnType = self::LEARN_SPAM])

Uses SpamAssassin learning feature with TELL. Must be enabled on the server.



Tags:

return:  Whether it did learn or not
access:  public


Parameters:

string   $message   Raw email message
int   $learnType   self::LEARN_SPAM|self::LEARN_FORGET|self::LEARN_HAM

[ Top ]

method parseOutput [line 173]

SpamAssassin_Client_Result parseOutput( string $header, string $message)

Parses SpamAssassin output ($header and $message)



Tags:

return:  Object containing the result
access:  protected


Parameters:

string   $header   Output headers
string   $message   Output message

[ Top ]

method ping [line 264]

boolean ping( )

Pings the server to check the connection



Tags:

access:  public


[ Top ]

method process [line 345]

SpamAssassin_Client_Result process( string $message)

Processes the message, checks it for spam and returning it's modified version



Tags:

return:  Result details and modified message
access:  public


Parameters:

string   $message   Raw email message

[ Top ]

method read [line 142]

array read( resource $socket)

Reads all input from the SpamAssassin server after data was written



Tags:

return:  Array containing output headers and message
access:  protected


Parameters:

resource   $socket   Socket connection created by getSocket()

[ Top ]

method report [line 416]

boolean report( string $message)

Report message as spam, both local and remote



Tags:

access:  public


Parameters:

string   $message   Raw email message

[ Top ]

method revoke [line 433]

boolean revoke( string $message)

Revokes a message previously reported as spam



Tags:

access:  public


Parameters:

string   $message   Raw email message

[ Top ]

method symbols [line 357]

array symbols( string $message)

Returns all rules matched by the message



Tags:

return:  Array containing the names of the rules matched
access:  public


Parameters:

string   $message   Raw email message

[ Top ]

method write [line 129]

void write( resource $socket, string $data)

Writes data to the socket



Tags:

access:  protected


Parameters:

resource   $socket   Socket returned by getSocket()
string   $data   Data to be written

[ Top ]


Class Constants

LEARN_FORGET =  2

[line 16]


[ Top ]

LEARN_HAM =  1

[line 15]


[ Top ]

LEARN_SPAM =  0

[line 14]


[ Top ]



Documentation generated on Tue, 04 May 2010 15:12:08 -0300 by phpDocumentor 1.4.3