C# scripting is not supported in the Web app
See the compatibility table
See also:
Email Parser scripting SDK
Overview of scripting in Email Parser
Example – Basic use of a script in an action
Email Parser provides actions for the most common tasks (SQL, Excel, Command line, Web API …) but if you need to perform something different you can use C# to create your own action.
A script action is the implementation of the Run() method as it is shown below. This method takes the following parameters:
For instance, we can use a script to give contents to a field. Then we can use the contitional run action to trigger a database action.
// This is a sample script. More information and resources:
// https://www.emailparser.com/d/miscellaneous/automated-email-parser-scripting-sdk
// https://www.emailparser.com/d/automated-processes-other/creating-a-custom-automated-process-with-a-script
using System;
using System.Text;
using System.IO;
using System.Net.Mail;
using System.Collections.Specialized;
using EmailParserBackendApi.ScriptingInterface;
public class MyAction : ScriptBasedAction
{
// Place your own code in the Run method()
// It will be called each time this action runs
public override void Run(MailMessage email, NameValueCollection fields)
{
string order_type = fields["order_type"];
Print("Getting the order header");
switch(order_type)
{
case "internal":
fields.Add("confirmation_header","INTERNAL ORDER");
break;
case "regular":
fields.Add("confirmation_header","REGULAR ORDER");
break;
default:
fields.Add("confirmation_header","UNKNON ORDER TYPE");
break;
}
}
}