org.apache.james.util.scanner
Class SpamAssassinInvoker

java.lang.Object
  extended by org.apache.james.util.scanner.SpamAssassinInvoker

public class SpamAssassinInvoker
extends java.lang.Object

Sends the message through daemonized SpamAssassin (spamd), visit SpamAssassin.org for info on configuration.


Field Summary
static java.lang.String FLAG_MAIL_ATTRIBUTE_NAME
          The mail attribute under which the flag get stored
static java.lang.String STATUS_MAIL_ATTRIBUTE_NAME
          The mail attribute under which the status get stored
 
Constructor Summary
SpamAssassinInvoker(java.lang.String spamdHost, int spamdPort)
          Init the spamassassin invoker
 
Method Summary
 java.util.Map<java.lang.String,java.lang.String> getHeadersAsAttribute()
          Return the headers as attributes which spamd generates
 java.lang.String getHits()
          Return the hits which was returned by spamd
 java.lang.String getRequiredHits()
          Return the required hits
 boolean scanMail(javax.mail.internet.MimeMessage message)
          Scan a MimeMessage for spam by passing it to spamd.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATUS_MAIL_ATTRIBUTE_NAME

public static final java.lang.String STATUS_MAIL_ATTRIBUTE_NAME
The mail attribute under which the status get stored

See Also:
Constant Field Values

FLAG_MAIL_ATTRIBUTE_NAME

public static final java.lang.String FLAG_MAIL_ATTRIBUTE_NAME
The mail attribute under which the flag get stored

See Also:
Constant Field Values
Constructor Detail

SpamAssassinInvoker

public SpamAssassinInvoker(java.lang.String spamdHost,
                           int spamdPort)
Init the spamassassin invoker

Parameters:
spamdHost - The host on which spamd runs
spamdPort - The port on which spamd listen
Method Detail

scanMail

public boolean scanMail(javax.mail.internet.MimeMessage message)
                 throws javax.mail.MessagingException
Scan a MimeMessage for spam by passing it to spamd.

Parameters:
message - The MimeMessage to scan
Returns:
true if spam otherwise false
Throws:
javax.mail.MessagingException - if an error on scanning is detected

getHits

public java.lang.String getHits()
Return the hits which was returned by spamd

Returns:
hits The hits which was detected

getRequiredHits

public java.lang.String getRequiredHits()
Return the required hits

Returns:
required The required hits before a message is handled as spam

getHeadersAsAttribute

public java.util.Map<java.lang.String,java.lang.String> getHeadersAsAttribute()
Return the headers as attributes which spamd generates

Returns:
headers Map of headers to add as attributes


Copyright © 2002-2010 The Apache Software Foundation. All Rights Reserved.