How to use of a simple script to capture text from a received email

C# scripts are not supported in the Web app
See the item compatibility table

See also:
Capturing text with a script
An overview of Email Parser scripting

Download this example

exporting data from an email to a text file

This example show how to capture the first word of the email body with a small C# script. The code is as follows:

using System;
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<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);
	}
}

The script can be edited double-clicking the field “first_word_of_email_body”. But note that we encourage to use a full C# IDE (like Visual Studio) for doing this. This window is meant for just copying the script from the IDE and do minor adjustments:

editing the script in email parser

Processing one email produces the following output:

output tab in the email parsing window

© 2008-2024 Triple Click Software
News & Updates

Privacy Policy & Terms of Use
PAD file·Old news