Class MhtSaveOptions
Contents
[
Hide
]MhtSaveOptions class
Provides options for controlling how MailMessage instances are saved to MHTML format. This class allows you to customize MHTML output formatting, attachment handling, header preservation, and resource rendering behavior when converting email messages to MHTML (MIME HTML) files.
public class MhtSaveOptions : HeadersFormattingOptions
Constructors
| Name | Description |
|---|---|
| MhtSaveOptions() | Initializes a new instance of this class that can be used to save a MailMessage in the Mhtml format. |
Properties
| Name | Description |
|---|---|
| AfterHeadersFormat { get; set; } | After headers format. |
| BeforeHeadersFormat { get; set; } | Before headers format. |
| CheckBodyContentEncoding { get; set; } | Defines whether need check message body content encoding when saving. By default the value is false. |
| CssStyles { get; set; } | Gets or sets the additional css styles for the formatter. |
| CustomProgressHandler { get; set; } | Represents method that usually supplied by calling side and handles progress events. |
| DefaultHeaderFormat { get; set; } | Default header line format. |
| DefaultPageHeaderFormat { get; set; } | Default page header format. |
| ExtractHTMLBodyResourcesAsAttachments { get; set; } | Defines whether extract HTML body resources as attachments or not. Default value is false. |
| FormatTemplates { get; } | Gets the format templates. |
| 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. |
| MhtFormatOptions { get; set; } | Defines additional options when saving in MHTML format. Default value is MhtFormatOptions.WriteHeader | MhtFormatOptions.WriteOutlineAttachments. |
| PreserveOriginalBoundaries { get; set; } | Defines whether need keep original boundaries in mail message when saving or not. |
| PreserveOriginalDate { get; set; } | Defines whether need keep original date in mail message when saving or not. Default value is true. |
| RenderedContactFields { get; set; } | Defines groups of Contact fields which will be included in output mhtml. Default value is ContactFieldsSet.AllExisting. |
| RenderingHeaders { get; } | Gets list of headers for rendering. |
| SaveAllHeaders { get; set; } | Defines whether need to save all headers in output mhtml or not. Default value is false. |
| SaveAttachments { get; set; } | Gets or sets a value indicating whether to save attachments. |
| SavedHeaders { get; } | Gets list of headers which will be present in saved mhtml content. Default value is empty list. |
| SkipInlineImages { get; set; } | Defines whether skip references on images at saving in mhtml or not. Default value is false. |
| Timeout { get; set; } | Limits the time in milliseconds of formatting message while saving in Mht. Default value 3 sec. |
Events
| Name | Description |
|---|---|
| event ResourceHtmlRendering | Provides customization of rendering resources in html. |
| event TimeoutReached | Raised if timed out while saving to Mhtml. |
Remarks
Use this class with Save to save messages in MHTML format. MHTML is a web page archive format that combines HTML content and embedded resources into a single file. The MhtFormatOptions property controls formatting options, SaveAttachments determines whether attachments are included, and SavedHeaders allows you to specify custom headers to include in the output.
Examples
The following example shows how to save MailMessage as MHTML.
[C#]
var eml = MailMessage.Load("Message.eml");
eml.Save("target.mthml", SaveOptions.DefaultMhtml);
[Visual Basic]
Dim eml = MailMessage.Load("Message.eml")
eml.Save("target.mthml", SaveOptions.DefaultMhtml)
See Also
- class HeadersFormattingOptions
- namespace Aspose.Email
- assembly Aspose.Email