org.apache.james.smtpserver.core.filter.fastfail
Class SPFHandler

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler
          extended by org.apache.james.smtpserver.core.filter.fastfail.SPFHandler
All Implemented Interfaces:
org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled, CommandHandler, MessageHandler

public class SPFHandler
extends AbstractJunkHandler
implements CommandHandler, MessageHandler, org.apache.avalon.framework.activity.Initializable

SPFHandler which could be used to reject mail based on spf. The Following attributes org.apache.james.smtpserver.spf.header - Holds the header which can be attached later Sample Configuration:

<handler class="org.apache.james.smtpserver.core.SPFHandler" command="MAIL,RCPT"> <blockSoftFail>false</blockSoftFail> <checkAuthNetworks>false</checkAuthNetworks> </handler>


Field Summary
static java.lang.String SPF_BLOCKLISTED
           
static java.lang.String SPF_DETAIL
           
static java.lang.String SPF_HEADER
           
static java.lang.String SPF_HEADER_MAIL_ATTRIBUTE_NAME
           
static java.lang.String SPF_TEMPBLOCKLISTED
           
 
Constructor Summary
SPFHandler()
           
 
Method Summary
protected  boolean check(SMTPSession session)
          All checks must be done in this method
 void configure(org.apache.avalon.framework.configuration.Configuration handlerConfiguration)
           
 java.util.Collection getImplCommands()
          Return a Collection of implemented commands
 JunkHandlerData getJunkHandlerData(SMTPSession session)
          Get the JunkHandlerData to work with
 void initialize()
           
 void onCommand(SMTPSession session)
          Calls the SPFcheck
 void onMessage(SMTPSession session)
           
 void setBlockPermError(boolean blockPermError)
          block the email on a permerror
 void setBlockSoftFail(boolean blockSoftFail)
          block the email on a softfail
 void setCheckAuthNetworks(boolean checkAuthNetworks)
          Set to true if AuthNetworks should be included in the EHLO check
 void setDNSService(org.apache.james.jspf.core.DNSService dnsService)
          DNSService to use
 
Methods inherited from class org.apache.james.smtpserver.core.filter.fastfail.AbstractJunkHandler
doProcessing, getAction, getJunkScore, getScore, setAction, setScore
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPF_BLOCKLISTED

public static final java.lang.String SPF_BLOCKLISTED
See Also:
Constant Field Values

SPF_DETAIL

public static final java.lang.String SPF_DETAIL
See Also:
Constant Field Values

SPF_TEMPBLOCKLISTED

public static final java.lang.String SPF_TEMPBLOCKLISTED
See Also:
Constant Field Values

SPF_HEADER

public static final java.lang.String SPF_HEADER
See Also:
Constant Field Values

SPF_HEADER_MAIL_ATTRIBUTE_NAME

public static final java.lang.String SPF_HEADER_MAIL_ATTRIBUTE_NAME
See Also:
Constant Field Values
Constructor Detail

SPFHandler

public SPFHandler()
Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration handlerConfiguration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Overrides:
configure in class AbstractJunkHandler
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
Configurable.configure(Configuration)

initialize

public void initialize()
                throws java.lang.Exception
Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable
Throws:
java.lang.Exception
See Also:
Initializable.initialize()

setBlockSoftFail

public void setBlockSoftFail(boolean blockSoftFail)
block the email on a softfail

Parameters:
blockSoftFail - true or false

setBlockPermError

public void setBlockPermError(boolean blockPermError)
block the email on a permerror

Parameters:
blockPermError - true or false

setDNSService

public void setDNSService(org.apache.james.jspf.core.DNSService dnsService)
DNSService to use

Parameters:
dnsService - The DNSService

setCheckAuthNetworks

public void setCheckAuthNetworks(boolean checkAuthNetworks)
Set to true if AuthNetworks should be included in the EHLO check

Parameters:
checkAuthNetworks - Set to true to enable

onCommand

public void onCommand(SMTPSession session)
Calls the SPFcheck

Specified by:
onCommand in interface CommandHandler
See Also:
CommandHandler.onCommand(SMTPSession)

getImplCommands

public java.util.Collection getImplCommands()
Description copied from interface: CommandHandler
Return a Collection of implemented commands

Specified by:
getImplCommands in interface CommandHandler
Returns:
Collection which contains implemented commands
See Also:
CommandHandler.getImplCommands()

onMessage

public void onMessage(SMTPSession session)
Specified by:
onMessage in interface MessageHandler
See Also:
MessageHandler.onMessage(SMTPSession)

check

protected boolean check(SMTPSession session)
Description copied from class: AbstractJunkHandler
All checks must be done in this method

Specified by:
check in class AbstractJunkHandler
Parameters:
session - the SMTPSession
Returns:
true if the check match
See Also:
AbstractJunkHandler.check(org.apache.james.smtpserver.SMTPSession)

getJunkHandlerData

public JunkHandlerData getJunkHandlerData(SMTPSession session)
Description copied from class: AbstractJunkHandler
Get the JunkHandlerData to work with

Specified by:
getJunkHandlerData in class AbstractJunkHandler
Parameters:
session - the SMTPSession
Returns:
junkHandlerData
See Also:
AbstractJunkHandler.getJunkHandlerData(org.apache.james.smtpserver.SMTPSession)


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.