Show/Hide Toolbars

The Domain Filtering box in a Mail Sender's Advanced tab lets you configure rules for whether VPOP3 should attempt to send a message through a Mail Sender, or whether it should skip the message. This can be useful if you need to use different Mail Senders for different things, such as messages from different users going through different ISP SMTP relay accounts.

This uses a very simple scripting language which will allow the most common conditions to be expressed simply. If you need more advanced conditions, then you may need to use Lua scripting which can do much more, because Lua is a fully featured programming language, but it is also more complex.

Domain Filtering Scripting Language

In the Domain Filtering scripting language, each line is either a rule or a comment. There are no variables, loops, or other programming structures.

Comments are lines which start with a # character and the comment continues to the end of the line. Comments are ignored by VPOP3.

Blank lines are allowed and are also ignored by VPOP3.

The script is case insensitive (except for regular expression comparisons).

Rule lines start with either Attempt: or Skip: which are then followed by one or more conditions

If the line begins with Attempt: then VPOP3 will attempt to send any message which matches all of the conditions specified on the remainder of the line.

If the line begins with Skip: then VPOP3 will skip any message which matches all of the conditions specified on the remainder of the line.

When VPOP3 finds an Attempt: or Skip: line which matches, it will stop processing the rest of the script.

If VPOP3 reaches the end of the script without finding a matching line, it will assume an Attempt: All if no other Attempt: lines were found in the script, or it will assume a Skip: All if any Attempt: lines were found. So, an empty script is equivalent to Attempt: All

 

The available conditions are:

All

This always matches

None

This never matches

Numeric comparisons

SIZE (comparator) (size)

This checks the size of the message to be sent.

The comparator can be <>, =, <=, >= (or == or != for people used to programming languages)

The size can just be a number, or a number followed by kB or MB. Numbers followed by kB are multiplied by 1024; numbers followed by MB are multiplied by 1048576 (1024 kB)

For example: Skip: size > 50kB

RETRIES (comparator) (number)

This checks the number of times the message has been attempted so far.

The comparator can be <>, =, <=, >= (or == or != for people used to programming languages)

For example: attempt: retries >= 5

AGE (comparator) (age)

This checks how long the message has been in the Outgoing message queue.

The comparator can be <>, =, <=, >= (or == or != for people used to programming languages)

The age is a number followed by Minutes, Hours or Days (the 's' on the end is optional)

For example: Skip: age<10 minutes

Text Comparisons

For text comparisons, the comparator can be <>, =, (or == or != for people used to programming languages), CONTAINS, MATCHES, REGEXP, NOT CONTAINS, NOT MATCHES or NOT REGEXP

For MATCHES comparisons, the text is some case insensitive wildcard text within quotes, for instance "*@company.com" or "aa??@*.biz". This has to match the whole data (for a substring type match use * characters at the beginning and end).

For REGEXP comparisons, the text is a Perl compatible regular expression within / / characters. These are case sensitive. If you want them to be case insensitive, put an 'i' after the last / character.

For CONTAINS comparisons, the text is some text within quotes which needs to be contained within the data.

For = and <> comparisons, the text is some text within quotes which needs to match, or not match the data.

AUTHSENDER (comparator) (text)

This checks who sent the message (if they used authenticated SMTP).

For example: Attempt: Authsender matches "and*"

Skip: Authsender  = "bob"

FROM (comparator) (text)

This checks the email address which sent the message (the SMTP 'Return Path' value).

For example: Attempt: From matches "*@company.com"

Attempt: from not contains "joe"

TO (comparator) (text)

This checks the email address the message is to (the SMTP recipient). Note that if the message is to several recipients, this can filter which recipients will be attempted and which will be skipped by this sender. If recipients are skipped, they will still be queued to be attempted by other senders.

For example: attempt: to regexp /[abc]@company\.(org|com)$/i

 

Notes

1.It is recommended to have one Mail Sender which tries to send 'everything else'. So, if you have a Mail Sender which sends all mail from '*@example.com', then it's recommended to have another Mail Sender which sends all mail except that from '*@example.com'. If you don't do this, then you may find that you have messages in the VPOP3 Outqueue which VPOP3 can't send through any Mail Sender

2.Messages sent by VPOP3 itself (eg bounce messages, autoresponse messages etc) may have a blank SMTP Return Path. To send those, you need a rule such as: attempt: from regexp /^$/

 

Examples

Here are some simple examples of domain filtering rules.

 

Send all messages through this Sender except messages to example.com

skip: to matches "*@example.com"
attempt: all

 

Send messages through this sender only if they are to example.com or example.org

attempt: to regexp /@example\.(org|com)$/i

skip: all

 

Send only messages from bob through this Sender

attempt: authsender = "bob"
skip: all

If you think this help topic could be improved, please send us constructive feedback