Class EmlLoadOptions
Contents
[
Hide
]EmlLoadOptions class
Provides options for controlling how MailMessage instances are loaded from EML format. This class allows you to customize the loading behavior for specific EML features such as TNEF attachment handling and embedded message preservation.
public class EmlLoadOptions : LoadOptions
Constructors
| Name | Description |
|---|---|
| EmlLoadOptions() | Initializes a new instance of the EmlLoadOptions class with the default options. |
Properties
| Name | Description |
|---|---|
| MessageFormat { get; } | Gets the format this options object loads, as determined by its class: EML, MSG, MHTML, HTML and so on. |
| PreferredTextEncoding { get; set; } | Gets or sets the encoding used for the subject and the body regardless of what the message declares. The default is null: the declared encoding is used. |
| PreserveEmbeddedMessageFormat { get; set; } | Gets or sets a value indicating whether embedded messages keep their original format (EML or MSG) when loaded. The default is false. |
| PreserveTnefAttachments { get; set; } | Gets or sets a value indicating whether a TNEF attachment (winmail.dat) is kept as it is instead of being decoded into its files. The default is false. |
| RemoveSignature { get; set; } | Gets or sets a value indicating whether the digital signature is removed from a signed message while it is loaded. |
Remarks
Use this class with Load to specify custom loading options. Inherits from LoadOptions and adds EML-specific configuration through properties like PreserveTnefAttachments.
Examples
The following example shows how to convert EML to MSG.
[C#]
// Initialize EmlLoadOptions
var emlLoadOptions = new EmlLoadOptions()
{
PreserveTnefAttachments = true,
PreserveEmbeddedMessageFormat = true
};
// Initialize MailMessage with EmlLoadOptions
using (MailMessage message = MailMessage.Load("TestEml.eml", emlLoadOptions))
{
// Convert EML to MSG
message.Save("output.msg", SaveOptions.DefaultMsg);
}
[Visual Basic]
' Initialize EmlLoadOptions
Dim emlLoadOptions = New EmlLoadOptions() With
{
.PreserveTnefAttachments = True,
.PreserveEmbeddedMessageFormat = True
}
' Initialize MailMessage with EmlLoadOptions
Using message As MailMessage = MailMessage.Load("TestEml.eml", emlLoadOptions)
' Convert EML to MSG
message.Save("output.msg", SaveOptions.DefaultMsg)
End Using
See Also
- class LoadOptions
- namespace Aspose.Email
- assembly Aspose.Email