Running a C# script

C# scripting is not supported in the Web app but AWS scripting is available
See the item compatibility table

See also:
Email Parser scripting SDK
Overview of scripting in Email Parser
Example – Basic use of a script in an action

running a cs code as part of email text capturing

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 check the database server availability with the following script and store the result in a field. Then we can use the contitional run action to trigger the database action.

using System;
using System.Text;
using System.IO;
using System.Net.Mail;
using System.Net.NetworkInformation;
using System.Collections.Specialized;
using EmailParserBackend.ScriptingInterface;
 
public class MyAction : ScriptBasedAction
{
	public override bool Run(MailMessage email, NameValueCollection fields)
	{
        // Check if the database server is online
        string database_server_ip_address = "192.168.0.45";
        Ping pingSender = new Ping();
        PingReply reply = pingSender.Send(database_server_ip_address);
        if (reply.Status == IPStatus.Success)
            fields.Add("is_online_db_server", "yes");
        else
            fields.Add("is_online_db_server", "no");
 
        return (true);
	}
}

© 2008-2021 FrozenFrog Software  ·  Privacy Policy & Terms of Use
PAD file  ·  Old email parsing forums (now read only)