email parsing automation

Email Parser

Extract data from emails and automate your workflow

The forum is now read only. Please, go to the the main Email Parser website if you need help.
Need help configuring the program? Have any questions regarding its use?
I want to filter emails based on only the first word in the subject line or body of an email. For example, emails starting with the word "Farm" but not "Farmer", "Soccer" but not "Soccer Team".

How do I do this?
As of version 3.4 the only way to do that filter is writing a script filter. The upcoming new version allows to use regular expression (apart from scripting) for more advanced filtering.

In the meantime. Take a look at this script filter example:

[syntax=csharp]
using System;
using System.Net.Mail;
using EmailAndParser.ScriptingInterface;

public class MyFilter : ScriptBasedEmailFilter // do not modify class name
{
public override bool FilterEmail(MailMessage msg) // do not modify method header
{

// break the subject line into words
string[] words = msg.Subject.Split(' ');

// if we did not get any word (subject empty) the filter is not passed
if(words.Length==0)
return(false);

// Check if the first word is "Farm"
if(words[0].Equals("Farm",StringComparison.OrdinalIgnoreCase))
return(true);

if (words.Length <= 2)
return (false);

// Check if the first word is Soccer but the second is different than "Soccer team"
if (words[0].Equals("Soccer", StringComparison.OrdinalIgnoreCase) && !words[1].Equals("Team", StringComparison.OrdinalIgnoreCase))
return(true);


return (false);

}
}
[/syntax]