Class EmlSaveOptions

EmlSaveOptions class

Provides options for controlling how MailMessage instances are saved to EML and EMLX format. This class allows you to customize the saving behavior for features such as embedded message format preservation, TNEF handling, signed message integrity, and boundary template configuration.

public class EmlSaveOptions : SaveOptions

Constructors

NameDescription
EmlSaveOptions(MailMessageSaveType)Initializes a new instance of this class that can be used to save a MailMessage in the Eml and Emlx format.

Properties

NameDescription
BoundariesTemplate { get; set; }Gets or sets the boundary template for the message. Default value is null.
CheckBodyContentEncoding { get; set; }Defines whether need check message body content encoding when saving. By default the value is false.
CustomProgressHandler { get; set; }Represents method that usually supplied by calling side and handles progress events.
FileCompatibilityMode { get; set; }Defines inner conversions,that are necessarily to be done when saving a message. The default value is FileCompatibilityMode.None.
MailMessageSaveType { get; set; }Represents the mail message save type.It can be in eml,msg(ASCII or Unicode),mhtml or html format. The default value is Eml.
PreserveEmbeddedMessageFormat { get; set; }Gets or sets a value indicating whether it is necessary to preserve MSG format of embedded message at converting to MailMessage. By default the value is false.
PreserveSignedContent { get; set; }Gets or sets a value indicating whether it is necessary to save signed message without changes of content to provide correctly structure of digital sign. By default the value is false.

Remarks

Use this class with Save to specify custom save options. Inherits from SaveOptions and adds EML/EMLX-specific configuration through properties like PreserveEmbeddedMessageFormat, PreserveSignedContent, and BoundariesTemplate.

Examples

The following example shows how to load and Save an EML message Preserving the embedded message format.

[C#]

MailMessage mailMessage = MailMessage.Load("source.eml");
// Save as eml with preserved embedded message format
EmlSaveOptions emlSaveOptions = new EmlSaveOptions(MailMessageSaveType.EmlFormat)
{
     PreserveEmbeddedMessageFormat = true
};
mailMessage.Save("target.eml", emlSaveOptions);

[Visual Basic]

Dim mailMessage As MailMessage = MailMessage.Load("source.eml")

' Save as eml with preserved embedded message format
Dim emlSaveOptions As EmlSaveOptions = New EmlSaveOptions(MailMessageSaveType.EmlFormat) With {
       .PreserveEmbeddedMessageFormat = True
       }
		}
mailMessage.Save("target.eml", emlSaveOptions)

See Also