public static void Run()
{
// The path to the File directory.
string dataDir = RunExamples.GetDataDir_Email();
// Create an instance of MailMessage and load an email file
MailMessage mailMsg = MailMessage.Load(dataDir + "Test.eml", new EmlLoadOptions());
foreach (Attachment attachment in mailMsg.Attachments)
{
// To display the the attachment file name
attachment.Save(dataDir + "ExtractAttachments_out." + attachment.Name);
Console.WriteLine(attachment.Name);
}
}
}