Skip to main content
Parse an email with C#
Updated over a week ago

Use the SigParser v3 Nuget package to parse an email with C# like the example below shows. This is using an "msg" file but you could use a ".eml" file which is just MIME or you could provide a C# object.

using System;
using System.Diagnostics;
using SigParser.Api;
using SigParser.Client;
using SigParser.Model;


// Configure API key authorization: x-api-key
Configuration.ApiKey.Add("x-api-key", "PUT YOUR API KEY HERE");
Console.WriteLine("Starting");


try
{
var apiInstance = new ParseApi();

using var filestream = System.IO.File.OpenRead("example.msg");
IPaasAPIModelsParseEmailSignatureV2Model result = apiInstance.ApiParseEmailContactMSGPost(filestream);
Console.WriteLine("Finished request");
Console.WriteLine(result);
}
catch (ApiException e)
{
Console.WriteLine($@"Exception when calling ParseApi.ApiParseEmailContactMSGPost: {e.ErrorCode} {e.ErrorContent}

{e.ToString()}");
}

Did this answer your question?