Capturing text with a C# script

The Web app does not support running C# scripts. See the compatibility table

See also:
Overview of scripting in Email Parser
Email Parser scripting SDK
Example – Basic use of a script to capture text from an email

using a script for email parsing
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 EmailParserBackendApi.ScriptingInterface;
public class MyScriptBasedEmailParser : ScriptBasedParser
	// Modify this method to implement your own text capture
	public override List ExtractTextFrom(string input_text)
        List returned_values = new List();
        // Get the first word of the incoming email
        char[] valid_word_separators = new char[] { ' ', ',', '.', ':' };
        string[] words = input_text.Split(valid_word_separators,StringSplitOptions.RemoveEmptyEntries);
As you can see, you need to implement the method ExtractTextFrom() that takes any field (body, subject, CC, etc) as input and outputs a list of captured text strings. It is highly recommended to write the script in Visual Studio, using the Email Parser scripting SDK. The text editor embedded in Email Parser is very basic and lacks many useful features such as debugging, Intellisense, etc.

© 2008-2024 Triple Click Software
News & Updates

Privacy Policy & Terms of Use
PAD file·Old news