Why do messages get through MML filters?

  1. Home
  2. Knowledge Base
  3. GMS
  4. Why do messages get through MML filters?


The MML filter is set up to look for multiple occurences of a specific word and to ban emails where the occurence of this word exceeds the given number.


Imagine a filter that checks for a word “banned” occuring 5 times in an incoming message. This creates the following script

if (emailX-MMLScript == "")
action = 0;
if (action == 0)
x = FilterMsg(email,   "banned");
if (LSElement(x,  1) > 4)
action = "1";
parameter = "550 contains disallowed word";

If the word “banned” occurs 9 times or less in the message, the script functions correctly, and the mesage is rejected with the error “550 contains disallowed word”.

However if the word “banned” exists greater than 9 times in the message it will pass through the script and will not be rejected.

This is because the MML parser is designed to treat this as a string comparison, as the result of LSElement is a string. Consequently if it finds 10 occurences of the word, this is equivalent to finding it one time.

To correctly trap and reject these messages you need to use an integer comparison and hence should use the ToInt MML function to convert the result of LSElement to an integer which will then be correctly used in comparisions.

This means that the line:

if (LSElement(x,1) > 4)

in the script above will become

if (ToInt(LSElement(x,1)) > 4)

Keywords:MML, Filters, banned, words

Was this article helpful?

Related Articles