Top  Previous  Next

Example projects > Plain text parsers > Emptymail


The example project Emptymail.ttp in the application data folder works similarly as the Spamihilator empty mail filter. The example shall not at all replace the more flexible empty mail filter. The Emptymail project is made for the didactic reason only that it is very simple. The complete project consists of only two lines:



  SKIP {{ out << 0; }}

| {{ out << -1; }}   



SKIP is a special token in the TextTransformer. The complete text is matched with SKIP up to the position, where a token matches, that follows on SKIP. Here nothing follows on SKIP, though, but the end of the text. Therefore the complete text is recognized with SKIP, if there is one. If the mail doesn't include any text the alternative behind the or '|'  is executed: "{{" out <<-1 ; }}"

The brackets "{{ ... }}" enclose actions. The action "out << -1" means, that the value -1 is output and this value represents spam. The value 0, however, means that the filter cannot decide, whether the text is spam or not.