public class WhiteListManager
extends org.apache.mailet.base.GenericMailet
Manages for each local user a "white list" of remote addresses whose messages should never be blocked as spam.
The normal behaviour is to check, for a local sender, if a remote recipient is already in the list: if not, it will be automatically inserted. This is under the interpretation that if a local sender X sends a message to a remote recipient Y, then later on if a message is sent by Y to X it should be considered always valid and never blocked; hence Y should be in the white list of X.
Another mode of operations is when a local sender sends a message to whitelistManagerAddress with one of three specific values in the subject, to (i) send back a message displaying a list of the addresses in his own list; (ii) insert some new addresses in his own list; (iii) remove some addresses from his own list. In all this cases the message will be ghosted and the postmaster will reply to the sender.
The sender name is always converted to its primary name (handling aliases).
Sample configuration:
<mailet match="SMTPAuthSuccessful" class="WhiteListManager">
<repositoryPath> db://maildb </repositoryPath>
<!--
If true automatically inserts the local sender to remote recipients entries in the whitelist (default is false).
-->
<automaticInsert>true</automaticInsert>
<!--
Set this to an email address of the "whitelist manager" to send commands to (default is null).
-->
<whitelistManagerAddress>whitelist.manager@xxx.yyy</whitelistManagerAddress>
<!--
Set this to a unique text that you can use (by sending a message to the "whitelist manager" above)
to tell the mailet to send back the contents of the white list (default is null).
-->
<displayFlag>display whitelist</displayFlag>
<!--
Set this to a unique text that you can use (by sending a message to the "whitelist manager" above)
to tell the mailet to insert some new remote recipients to the white list (default is null).
-->
<insertFlag>insert whitelist</insertFlag>
<!--
Set this to a unique text that you can use (by sending a message to the "whitelist manager" above)
to tell the mailet to remove some remote recipients from the white list (default is null).
-->
<removeFlag>remove whitelist</removeFlag>
</mailet>
IsInWhiteList
Constructor and Description |
---|
WhiteListManager() |
Modifier and Type | Method and Description |
---|---|
String |
getMailetInfo()
Returns a string describing this mailet.
|
void |
init()
Initializes the mailet.
|
void |
service(org.apache.mailet.Mail mail)
Services the mailet.
|
void |
setDataSource(DataSource datasource) |
void |
setUsersRepository(UsersRepository localusers) |
public void setDataSource(DataSource datasource)
public void setUsersRepository(UsersRepository localusers)
public void init() throws javax.mail.MessagingException
init
in class org.apache.mailet.base.GenericMailet
javax.mail.MessagingException
public void service(org.apache.mailet.Mail mail) throws javax.mail.MessagingException
service
in interface org.apache.mailet.Mailet
service
in class org.apache.mailet.base.GenericMailet
javax.mail.MessagingException
public String getMailetInfo()
getMailetInfo
in interface org.apache.mailet.Mailet
getMailetInfo
in class org.apache.mailet.base.GenericMailet
Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.