Managing Message Files with Aspose.Email.Outlook
Converting MSG to MIME message
Aspose.Email API provides the capability of converting MSG files to MIME messages using the toMailMessage method.
Read and Write Outlook Template File (OFT)
Outlook templates are very useful when you want to send a similar email message again and again. Instead of preparing the message from scratch each time, you can first prepare the message in Microsoft Outlook and save it as an Outlook Template (OFT). After that, if you need to send the message, create it from the template and save time for writing up the same text in the body, subject, etc.
Aspose.Email’s MailMessage class can be used to load a Microsoft Outlook template (OFT) file. Once the Outlook template is loaded in an instance of the MailMessage class, you may update the sender, recipient, body, subject and other properties. After updating the properties, you can
- send the email using SmtpClient class, or
- save the message as MSG and do further updates or validation using Microsoft Outlook.
In the below screenshot, you can see a meeting invitation template, which is prepared using Microsoft Outlook and saved as an Outlook template (OFT). The example code loads this template using the MailMessage class, updates some of the properties and saves the message in MSG format.
|Figure: Email template|
|After running the code, the email will look like the message below when it is opened in Microsoft Outlook.|
|Figure: The output email|
Save as Outlook Template File (OFT)
Just as the API can read OFT files, it also provides the capability to write to OFT files as shown in the following code sample.
Setting Color Category for Outlook Message (MSG) Files
Microsoft Outlook lets users assign color categories to differentiate emails. A color category marks an email as being of some kind of importance or category. Aspose.Email provides the same feature through the FollowUpManager class. The following functionality is supported via this class:
- addCategory() takes MapiMessage and the color category string as arguments.
- removeCategory() takes MapiMessage and the color category string to be removed from the message as arguments.
- clearCategories() is used to remove all the color categories from the message.
- getCategories() is used to retrieve all the color categories from a particular message.
The following example performs the tasks as given below:
- Add a color category.
- Add another color category.
- Retrieve the list of all categories.
- Remove all categories.
Accessing Follow Up Information from Message
Aspose.Email API provides the capability to access the follow-up information from a sent or received message. It can retrieve the Read, Delivery Read Receipt and vote results information from a message file.
Retrieve Read and Delivery Receipt Information
Read the Vote Results Information
Creating Forward and Reply Messages
Aspose.Email API provides the capability of creating and formatting the forward and reply messages. The ReplyMessageBuilder and ForwardMessageBuilder classes of the API are used to create the Reply and Forward messages respectively. A Reply or Forward message can be specified to be created using any of the modes of OriginalMessageAdditionMode enum. This enum has the following values:
- OriginalMessageAdditionMode.None - The original message is not included in the response message.
- OriginalMessageAdditionMode.Attachment - The original message is included as an attachment in the response message
- OriginalMessageAdditionMode.Textpart - The original message is included as text in the body of the response message