Top  Previous  Next

Example projects > Plain text parsers > Formmail


The example project Formmail.ttp demonstrates how mails can be classified obviously as not spam if they have a certain structure. Since the project doesn't reject any mail as spam, again it should be put near the top in the list of the filters.


Only an imaginary company mail is accepted as non-spam. E.g. following mail.



Sender: Fatty

Subject: diet

Message: don't like it!



The project consists of the productions:


Sender ::= SKIP EOL

Subject: "Subject:" SKIP EOL 

Message ::= "Message:" SKIP?   


Formmail ::= Sender Subject Message  {{ out << 1; }}  


EOL is a regular expression which represents a line ending. It is defined in the TextTransformer on the token page by: \r?\n.

Although blanks and line breaks are ignored per default project options of the TextTransformer, EOL is recognized nevertheless as a successor of SKIP.


Notice, that this project always returns the value 1 (for not spam). Nevertheless there is no danger that spam is accepted, because it is sure that a mail which has not the specified structure, can't be parsed until its end at all. In this case the value for parser errors is used in the Spamihilator instead. This value necessarily should therefore be set to "indifferent" for this project.



Mails without senders and subject also aren't parsed. How can you change this?