Matchers

James provides a number of implemented Matchers for use by James administrators in their configurations. These are primarily matchers that members of the James developer or user communities have found useful in their own configurations. A description of how to configure Matchers and use them in the James SpoolManager can be found here.

All

Description: This matcher is the trivial one - it matches all mails being processed. All recipients are returned.

Configuration string: None.

AttachmentFileNameIs

Description: It can be used to refuse emails with SCR, PIF, EXE etc. attachments. It matches mails that has a file attachment with a file name meeting one of the supplied filters. All recipients are returned.

Configuration string: A comma or space delimited list of file names. File names may start with a wildcard '*'. Example: *.scr,*.bat,*.pif,*.pi,*.com,*.exe


<mailet match="AttachmentFileNameIs=value, value, .." class="<any-class>">

CommandForListserv

Description: The CommandForListserv matcher is used as a simple filter to recognize emails that are list server commands. It will match any email addressed to the list server host, as well as any email that is addressed to a user named <prefix>-on or <prefix>-off on any host. Only those matching recipients will be returned.

Configuration string: An email address of the form <prefix>@<host>, where host is the hostname used for the listserver and prefix is the command prefix.


<mailet match="CommandForListserv=james-on@list.working-dogs.com" class="<any-class>">

CommandForListservManager

Description: CommandListservMatcher is the matcher that pairs with the CommandListservManager mailet. It checks to see if the request is intended for the ListservManager, but doesn't guarantee that it is a valid command. Only those matching recipients will be returned.

Configuration string: An email address.


<mailet match="CommandForListservManager=announce@localhost" class="<any-class>">

CompareNumericHeaderValue

Description: Matches mails containing a header with a numeric value whose comparison with the specified value is true. If the header is missing in the message, there will be no match. All recipients are returned.

Configuration string: The headerName, a comparison operator and the numeric headerValue to compare with, space or tab delimited.


<mailet match="CompareNumericHeaderValue= X-MessageIsSpamProbability > 0.9" class="<any-class>">

FetchedFrom

Description: A matcher intended for use with the FetchMail server. It matches a custom header (X-fetched-from) that is set by the FetchMail server. FetchMail sets this header to the name of the FetchPOP task which originally fetched the message. All recipients are returned.

Configuration string: The name of the FetchMail task which originally fetched the message.


<mailet match="FetchedFrom=value" class="<any-class>">

FileRegexMatcher

Description: A matcher which can be used to match on a attachment when the given regex match. All recipients are returned.

Configuration string: A regex for match attachmentname.


<mailet match="FileRegexMatcher=value" class="<any-class>">

HasAttachment

Description: Matches those messages with a MIME type of "multipart/mixed". All recipients are returned.

Configuration string: None.

HasHabeasWarrantMark

Description: Matches mails that have the Habeas Warrant (see http://www.habeas.com for details). All recipients are returned.

Configuration string: None.

HasHeader

Description: Matches mails that have the specified header. All recipients are returned.

Configuration string: The name of the header whose presence determines the match.


<mailet match="HasHeader=value" class="<any-class>">

HasMailAttribute

Description: Matches mails that have the specified Mail Attribute. All recipients are returned.

Configuration string: The name of the Mail Attribute to match. For example:


<mailet match="HasMailAttribute=name" class="<any-class>">

HasMailAttributeWithValue

Description: Matches mails that have the specified Mail Attribute and the specified MailAttribute value. All recipients are returned.

MailAttributes are types of Object whereas the value specified in the Matcher condition is of type String. The toString() method is used to obtain a String representation of the Mail Attribute value for matching. The String.equals(String) method tests for a match.

Configuration string: The name of the Mail Attribute to be matched, a comma and then the String value to be matched. For example:


<mailet match="HasMailAttributeWithValue=name, value" class="<any-class>">

HasMailAttributeWithValueRegex

Description: Matches mails that have the specified Mail Attribute and a MailAttribute value that matches the specified regular expression. All recipients are returned.

MailAttributes are types of Object whereas the value specified in the Matcher condition is of type String. The toString() method is used to obtain a String representation of the Mail Attribute value for matching. The regular expression must follow Perl5 syntax.

Configuration string: The name of the Mail Attribute to be matched, a comma and then the regular expression used to match the value against. For example:


<mailet match="HasMailAttributeWithValueRegex=name, regex" class="<any-class>">

HostIs

Description: Matches mails that are sent to email addresses on hosts that are in the configuration list. Only recipients that are on one of the hosts are returned.

Configuration string: A list of host names, comma or space delimited.


<mailet match="HostIs=value, value, .." class="<any-class>">

HostIsLocal

Description: Matches mails that are sent to email addresses on local hosts. Only recipients that are on one of the local hosts are returned.

Configuration string: None.

InSpammerBlacklist

Description: Checks the mail against one of a number of mail-abuse.org IP lists. All recipients are returned

Configuration string: One of three strings - "blackholes.mail-abuse.org", "relays.mail-abuse.org", or "dialups.mail-abuse.org".

IsInWhiteList

Description: Matches recipients having the mail sender in the recipient's private whitelist. The recipient name is always converted to its primary name (handling aliases).

Configuration string: The database name containing the white list table.


<mailet match="IsInWhiteList=db://maildb" class="ToProcessor">
  <processor> transport </processor>
</mailet>

IsSingleRecipient

Description: Matches those messages sent to only a single recipient. The single recipient is returned.

Configuration string: None.

NESSpamCheck

Description: A matcher derived from a Netscape Mail Server spam filter. If the matcher detects headers that indicate spam, the message is matched. All recipients are returned.

Configuration string: None.

RecipientIs

Description: Matches mails that are sent to one of the recipients on a specified list. Only matching recipients are returned.

Configuration string: A list of recipient addresses, comma, tab, or space delimited.


<mailet match="RecipientIs=value, value, .." class="<any-class>">

RecipientIsLocal

Description: Matches mails that are sent to email addresses on local hosts with users that have local acccunts. Only matching recipients are returned.

Configuration string: None.

RecipientIsOverFixedQuota

Description: Matches mails that are send to email addresses which are over the given quota. Only matching recipients are returned.

Configuration string: The quota


<mailet match="RecipientIsOverFixedQuota=10m" class="<any-class>">

RecipientIsRegex

Description: Matches mails that are send to email addresses which are matched given regex. Only matching recipients are returned.

Configuration string: The quota


<mailet match="RecipientIsRegex=value" class="<any-class>">

RelayLimit

Description: Counts the number of Received headers in the mail (each of which represents a server in the relay chain). If the number equals or exceeds the specified limit, the mail is matched. All recipients are returned.

Configuration string: a positive integer that is the limit on the number of relays.


<mailet match="RelayLimit=value" class="<any-class>">

RemoteAddrInNetwork

Description: Checks the remote address from which the mail was received against the configured list. If the address matches one on the list, the matcher considers it a match. All recipients are returned.

Configuration string: A list of domain names, IP addresses, or wildcarded IP subnets of any class. The list may be comma or space delimited.


<mailet match="RemoteAddrInNetwork=value, value, .." class="<any-class>">

RemoteAddrNotInNetwork

Description: Checks the remote address from which the mail was received against the configured list. If the address doesn't match one on the list, the matcher considers it a match. All recipients are returned.

Configuration string: A list of domain names, IP addresses, or wildcarded IP subnets of any class. The list may be comma or space delimited.


<mailet match="RemoteAddrNotInNetwork=value, value, .." class="<any-class>">

SenderHostIs

Description: Matches mails where the host name in the address of the sender cannot be resolved. All recipients are returned.

Configuration string: None.

SenderInFakeDomain

Description: Matches mails where the host name in the address of the sender cannot be resolved. All recipients are returned.

Configuration string: None.

SenderIs

Description: Matches mails that are sent by one of the senders on a specified list. All recipients are returned.

Configuration string: A list of sender addresses, comma, tab, or space delimited.


<mailet match="SenderIs=value, value, .." class="<any-class>">

SenderIsNull

Description: Matches mails that are sent by a null sender.

Configuration string: none.


<mailet match="SenderIsNull" class="<any-class>">

SenderIsRegex

Description: Matches mails that are sent by one of the senders matched the given regex. All recipients are returned.

Configuration string: A regex.


<mailet match="SenderIsRegex=value" class="<any-class>">

SizeGreaterThan

Description: Matches emails with a total message size (headers and body) greater than the specified limit. All recipients are returned.

Configuration string: a positive integer followed by an 'm' or a 'k'. This is the maximum message size permitted specified in megabytes or kilobytes respectively.


<mailet match="SizeGreaterThan=1m" class="<any-class>">

SMTPAuthSuccessful

Description: Matches mails that are send from an authorized sender. All recipients are returned.

Configuration string: none.


<mailet match="SMTPAuthSuccessful" class="<any-class>">

SMTPAuthUserIs

Description: Matches mails that are send from one of the given authorized senders. All recipients are returned.

Configuration string: none.


<mailet match="SMTPAuthUserIs=value, value, .." class="<any-class>">

SubjectIs

Description: Matches emails with the specified subject. All recipients are returned.

Configuration string: The string against which mail subject headers are matched.


<mailet match="SubjectIs=value" class="<any-class>">

SubjectStartsWith

Description: Matches emails whose subject header starts with the specified string. All recipients are returned.

Configuration string: The string against which mail subject headers are matched.


<mailet match="SubjectStartsWith=value" class="<any-class>">

UserIs

Description: Matches mails that are sent to email addresses that have userids that are in the configuration list. Only matching recipients are returned.

Configuration string: A list of user names, comma or space delimited.


<mailet match="UserIs=value, value, .." class="<any-class>">