public static void Run()
{
// ExStart:LoadMessageWithLoadOptions
// The path to the File directory.
string dataDir = RunExamples.GetDataDir_Email();
// Load Eml, html, mhtml, msg and dat file
MailMessage mailMessage = MailMessage.Load(dataDir + "Message.eml", new EmlLoadOptions());
MailMessage.Load(dataDir + "description.html", new HtmlLoadOptions());
MailMessage.Load(dataDir + "Message.mhtml", new MhtmlLoadOptions());
MailMessage.Load(dataDir + "Message.msg", new MsgLoadOptions());
// loading with custom options
EmlLoadOptions emlLoadOptions = new EmlLoadOptions
{
PrefferedTextEncoding = Encoding.UTF8,
PreserveTnefAttachments = true
};
MailMessage.Load(dataDir + "description.html", emlLoadOptions);
HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions
{
PrefferedTextEncoding = Encoding.UTF8,
ShouldAddPlainTextView = true,
PathToResources = dataDir
};
MailMessage.Load(dataDir + "description.html", emlLoadOptions);
// ExEnd:LoadMessageWithLoadOptions
}
}