de.malowa.greylister.trap
Class ConcreteSpamTrap

java.lang.Object
  extended by de.malowa.greylister.trap.SpamTrap
      extended by de.malowa.greylister.trap.ConcreteSpamTrap

public final class ConcreteSpamTrap
extends SpamTrap

Concrete implementation of a spam trap. If an email arrives for a special recipient known as a spam trap, the mail will be redirected to an other recipient. The mail can then be used for further analysis.
The spam trap addresses will be read from the database defined in jgreylister.properties:

 useSpamtrap=false
 spamtrap.dbms=hsqldb
 spamtrap.server=localhost
 spamtrap.database=provider
 spamtrap.user=sa
 spamtrap.token=
 

Author:
Marcel Lohmann

Constructor Summary
ConcreteSpamTrap(java.sql.Connection connection)
          Constructor of the concrete spam trap.
 
Method Summary
 void cleanUp()
          Clears the internal cache of spamming clients.
 java.lang.String getAction(java.lang.String recipient)
          Retrieves the final spam recipient for the given spam trap.
 boolean isSpamLover(java.lang.String recipient)
          Checks the mail address für being a spam trap
 boolean sentSpamLately(SMTPInformation recipient)
          Looks up the sending IP if it is already known for spamming.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcreteSpamTrap

public ConcreteSpamTrap(java.sql.Connection connection)
Constructor of the concrete spam trap.

Parameters:
connection - to the spam trap database
Method Detail

sentSpamLately

public boolean sentSpamLately(SMTPInformation recipient)
Looks up the sending IP if it is already known for spamming. The number of times an IP is safe for spamming is defined by the class SpamCount.

Specified by:
sentSpamLately in class SpamTrap
Parameters:
recipient - information of SMTP dialog
Returns:
true if the given sender IP is known for continous spamming

cleanUp

public void cleanUp()
Clears the internal cache of spamming clients. All entries older than two ours will be deleted.

Specified by:
cleanUp in class SpamTrap

isSpamLover

public boolean isSpamLover(java.lang.String recipient)
Checks the mail address für being a spam trap

Specified by:
isSpamLover in class SpamTrap
Parameters:
recipient - email address to check
Returns:
true if the email address is a spam trap

getAction

public java.lang.String getAction(java.lang.String recipient)
Retrieves the final spam recipient for the given spam trap.

Specified by:
getAction in class SpamTrap
Parameters:
recipient - email address of a spam trap
Returns:
the REDIRECT action with the final spam recipient