public class SpamAssassinHandler extends Object implements JamesMessageHook, InitializingLifecycleAwareProtocolHandler
This MessageHandler could be used to check message against spamd before accept the email. So its possible to reject a message on smtplevel if a configured hits amount is reached. The handler add the follow attributes to the mail object:
org.apache.james.spamassassin.status - Holds the status
org.apache.james.spamassassin.flag - Holds the flag
Sample Configuration:
<handler class="org.apache.james.smtpserver.SpamAssassinHandler"> <spamdHost>localhost</spamdHost> <spamdPort>783</spamdPort>
<spamdRejectionHits>15.0</spamdRejectionHits> <checkAuthNetworks>false</checkAuthNetworks> </handler>
Constructor and Description |
---|
SpamAssassinHandler() |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
void |
init(org.apache.commons.configuration.Configuration config)
Init with the given
Configuration |
org.apache.james.protocols.smtp.hook.HookResult |
onMessage(org.apache.james.protocols.smtp.SMTPSession session,
org.apache.mailet.Mail mail)
Handle Message
|
void |
setSpamdHost(String spamdHost)
Set the host the spamd daemon is running at
|
void |
setSpamdPort(int spamdPort)
Set the port the spamd daemon is listen on
|
void |
setSpamdRejectionHits(double spamdRejectionHits)
Set the hits on which the message will be rejected.
|
public void setSpamdHost(String spamdHost)
spamdHost
- The spamdHostpublic void setSpamdPort(int spamdPort)
spamdPort
- the spamdPortpublic void setSpamdRejectionHits(double spamdRejectionHits)
spamdRejectionHits
- The hitspublic org.apache.james.protocols.smtp.hook.HookResult onMessage(org.apache.james.protocols.smtp.SMTPSession session, org.apache.mailet.Mail mail)
JamesMessageHook
onMessage
in interface JamesMessageHook
JamesMessageHook.onMessage(org.apache.james.protocols.smtp.SMTPSession,
org.apache.mailet.Mail)
public void init(org.apache.commons.configuration.Configuration config) throws org.apache.commons.configuration.ConfigurationException
InitializingLifecycleAwareProtocolHandler
Configuration
init
in interface InitializingLifecycleAwareProtocolHandler
org.apache.commons.configuration.ConfigurationException
public void destroy()
destroy
in interface org.apache.james.protocols.api.handler.LifecycleAwareProtocolHandler
Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.