Products: IMail Server Plus, IMail Server, IMail Server Premium

How to filter email using rules

« Go Back



How can I filter out certain messages from arriving in my mailbox?


You can use rules on several parts of a message to filter mail. 

The syntax below shows the different portions of a message that can be filtered:

B~filtered content in body:spambox
S~filtered content in subject:spambox
H~filtered content in header:spambox
F~filtered content in From address:spambox
T~filtered content in To address:spambox
N~filtered content in Sender:spambox

The expressions for each element of a delivery rule follow:

Message Area
From: F
Subject: S
Sender: N
To: T
entire header (everything preceding the body) H
entire body of message B

Condition Expression
contains ~
does not contain !~
equals =
does not equal !=

Text Pattern Expression
Any character .
Any of the values separated by vertical bars within the parentheses; the 
vertical bar represents "or" (this|that|other)
Any word character (a-z, A-Z, 0-9) \w
Any non-word character \W
Any digit (0-9) \d
Any non-digit \D
Any white space (spaces and/or tabs and/or carriage returns) \s
Any non-white space \S
Any punctuation character (any character other than \w or \s) \p
Any non-punctuation character \P

Quantifier Expression
Zero or more *
One or more +
Exactly 100 {100}
At least n1, but not more than n2 (where n1 and n2 are numbers) {n1,n2}

Note: As shown above, the following characters have special meaning in a rule: {}()|*+,.:\ If you want to use one of these characters in a search string, precede it with a backslash. For example, to search for a plus sign, enter \+ in the search string.

Note that only the first 32,000 bytes of a message is checked. Please see the bottom of this page:

For example, if you wanted to monitor any mail with the subject "Kill Dusty", then you could have a rule like this:

S~catch dusty:spambox

This would catch messages with the subject:

"I want to catch Dusty"

but it would not catch:

"I am going to catch up with Dusty".

In this example, the ":spambox" sends the message to a subfolder in the user's mailbox called "spambox".

In this example, it is checking for messages with Nothing in the subject, or there is no subject line:
H!~Subject\: (\w|\S)*:NUL 
This searches the Header to see if there is a Subject: line and that it contains any word characters or any non-white space.

It is necessary to stop and restart the SMTP and Queue Manager services after making modifications to rules.ima to activate the new filter settings.

VersionAll Versions

Customer Service Softwaresalesforce.comHome | Product