If you are a .NET developer looking to add EMAIL to DOT conversion features inside your applications, Aspose.Total for .NET file format manipulation APIs are the way forward. By using Aspose.Email for .NET , you can convert EMAIL file format to HTML. After that, by using Aspose.Words for .NET , you can render HTML to DOT.
C# API to Convert EMAIL to DOT
- Open EMAIL file using MailMessage class
- Convert EMAIL to HTML by using Save method
- Load HTML by using Document class
- Save the document to DOT format using Save method and set Dot as SaveFormat
Get Started with .NET File Format APIs
Install from command line as nuget install Aspose.Total
or via Package Manager Console of Visual Studio with Install-Package Aspose.Total
.
Alternatively, get the offline MSI installer or DLLs in a ZIP file from downloads .
MailMessage message = MailMessage.Load("sourceFile.msg");
// save EMAIL as a HTML
message.Save("HtmlOutput.html", SaveOptions.DefaultHtml);
// load HTML with an instance of Document
Document document = new Document("HtmlOutput.html");
// call save method while passing SaveFormat.Dot
document.Save("output.dot", SaveFormat.Dot);
Parse EMAIL File via .NET
Before converting EMAIL to DOT, if you want to make sure that you are converting the correct email, you can load EMAIL document, parse it and have a look at your desired property. By using MapiMessage class of Aspose.Email for .NET API, you can get sender and recipients information. For example, you can check for a specific sender email for the conversion by using SenderName property.
var outlookMessageFile = MapiMessage.FromFile("message.msg");
// check for SenderName
if(outlookMessageFile.SenderName == "John"){
//proceed with conversion process
}
Restrict DOT Document Editing via .NET
While saving the document from EMAIL to DOT, you might need to protect your output document. Sometimes you may need to limit the ability to edit a document and only allow certain actions with it. This can be useful to prevent other people from editing sensitive and confidential information in your document. Aspose.Words for .NET API, enables you to control the way you restrict the content using the ProtectionType enumeration parameter. You can set your document to read-only by using the following lines of code.
Document document = new Document("HtmlOutput.html");
// apply document protection and set protection password
doc.Protect(ProtectionType.ReadOnly, "password");
// call save method while passing SaveFormat.Dot
document.Save("output.dot", SaveFormat.Dot);
Explore EMAIL Conversion Options with .NET
What is EMAIL File Format
An email file has a specific format that is recognized by email programs. The format includes a header and a body, which are separated by a blank line. The header contains the senders email address, the recipients email address, the subject of the email, and the date and time the email was sent. The body of the email contains the actual message. Email files can be in either plain text or HTML format. HTML emails are more common these days, as they can include images and other formatting.
Read MoreWhat is DOT File Format
DOT is a file format used by Microsoft Word and other word processing software to store documents. DOT files are similar to DOC files, but they are saved in a different format that is not compatible with DOC files. DOT files are saved in a text-based format that can be opened and edited in any text editor. DOT files can be converted to DOC files using a number of different methods, but the most common method is to use a word processing program that can read DOT files.
Read More