Browse our Products

Aspose.Email for .NET 24.12 Release Notes

All Changes

KeySummaryCategory
EMAILNET-41475MailMessage SaveOptions configuration to specify a template for boundary string generationFeature
EMAILNET-41471Saving MailMessage is not deterministicEnhancement
EMAILNET-41472Investigate IndexOutOfBoundsException in FindAndExtractSoftDeletedItems method with OST filesBug
EMAILNET-41480Fix soft-deleted items search method for OST 2013Bug

New Features

MailMessage SaveOptions Configuration for Custom Boundary String Templates

Aspose.Email for .NET now supports configuring the boundary template used in MIME messages. This feature allows to define a custom template for boundary string generation using the new EmlSaveOptions.BoundariesTemplate property.

The default value of BoundariesTemplate is null. When set, the {#} wildcard in the template will be replaced with the boundary number, enabling dynamic and customized boundary strings.

Example Usage

var saveOptions = new EmlSaveOptions(MailMessageSaveType.EmlFormat)
{
    BoundariesTemplate = "boundary--{#}"
};

eml.Save("Custom_Boundary_Message.eml", saveOptions);

Here is an example of the message structure with custom boundares saved using the code shown above:

From: sender@example.com  
To: recipient@example.com  
Subject: Custom_Boundary_Message  
Date: Fri, 27 Dec 2024 12:00:00 +0000
Content-Type: multipart/mixed;
 boundary="boundary--1"

This is a multi-part message in MIME format.

--boundary--1
Content-Type: multipart/alternative; boundary="boundary--2"


--boundary--2
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Content-Type: text/plain; charset="us-ascii"

This is the plain text content of the email.


--boundary--2
Content-Type: text/html; charset="windows-1251"
Content-Transfer-Encoding: quoted-printable

<html>
  <body>
    <p>This is the <b>HTML</b> content of the email.</p>
  </body>
</html>

--boundary--2--

--boundary--1
Content-Type: application/octet-stream; name="report-2023-08.xlsx"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="report-2023-08.xlsx"

UEsDBBQABgAIAAAAIQBi7...

--boundary--1--

This enhancement provides greater flexibility for developers working with MIME messages in EML format.