Skip to content

Instantly share code, notes, and snippets.

@wdormann
Created March 17, 2023 21:21
Show Gist options
  • Save wdormann/e1c649aafdb616b83e0fd508bf028255 to your computer and use it in GitHub Desktop.
Save wdormann/e1c649aafdb616b83e0fd508bf028255 to your computer and use it in GitHub Desktop.
Convert .MSG file to TNEF file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Aspose.Email;
namespace msgtotnef
{
class Program
{
static void Main(string[] args)
{
if (args.Length < 2)
{
Console.WriteLine("Usage: " + System.AppDomain.CurrentDomain.FriendlyName + " <input.msg> <output.tnef>");
}
else
{
string inputFile = args[0];
string outputFile = args[1];
using (Aspose.Email.Mapi.MapiMessage mailMessage = Aspose.Email.Mapi.MapiMessage.FromFile(inputFile))
{
mailMessage.SaveAsTnef(outputFile);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment