Email Parser

Extract data from emails and automate your workflow

Documentation topics:

Capturing text with a Script

In order to understand the following help topic you need some programming skills. Consider using our configuration services for the specific email filtering needs you may have.

See also
Email Parser scripting SDK
Using scripts to filter emails
Creating a custom process with a script
Example – Basic use of a script to capture text from an email

 

 

Most text capturing tasks can be done with other methods such as “Regular expressions match” or “Start with… continues until…” but for very specific cases you may need to write a script that captures the required information from the received email or even other sources.

A very simple script that returns the first word of the email body is the following:

using System;
using System.Text;
using System.Collections.Generic;
using EmailParser.Logic.ScriptingInterface;
public class MyScriptBasedEmailParser : ScriptBasedParser
{
	//
	// Modify this method to implement your own text capture
	//
	public override List<string> ExtractTextFrom(string input_text)
	{
        List<string> returned_values = new List<string>();
		
        // Get the first word of the incoming email
        char[] valid_word_separators = new char[] { ' ', ',', '.', ':' };
        string[] words = input_text.Split(valid_word_separators);
        returned_values.Add(words[0]);
        
        return(returned_values);
	}
}

As you can see, to write your own script-based parser you need to implement the methodExtractTextFrom() that takes any field (body, subject, CC, etc) as input.