Repository navigation
v1.1.0
Release v1.1.0
Release Date: February 23, 2025
NuGet Package: Proofpoint.SecureEmailRelay.Mail v1.1.0
Overview
This release introduces a fluent builder pattern for both Message and Attachment classes, enhancing usability while maintaining full backwards compatibility with v1.0.2. Key improvements include streamlined email composition and advanced inline attachment handling with dynamic and custom ContentId support. Existing code continues to work, though legacy methods are now marked [Obsolete] to encourage adoption of the new builder approach.
What’s New
-
Fluent Builder Pattern:
- Added
Message.Builder()for fluid email composition—chainFrom(),To(),Content(),Attachment(), etc., in any order. - Added
Attachment.Builder()for attachment creation—chainFromFile(),FromBytes(),FromBase64(), andDispositionInline().
- Added
-
Enhanced Inline Attachments:
- Dynamic ContentId: Use
.DispositionInline(out string contentId)to generate a UUID inline for<img src="cid:{contentId}">. - Manual ContentId: Use
.DispositionInline("customId")to set a specificContentId—e.g.,<img src="cid:logo">.
- Dynamic ContentId: Use
-
Backwards Compatibility:
- Legacy
new Message()andAdd*()methods remain functional. Attachment.FromFile(),FromBytes(),FromBase64()marked[Obsolete]—still work but encourage migration to builder.
- Legacy
Breaking Changes
- None! All existing v1.0.2 code runs unchanged—upgrade with confidence.
Example Usage
Dynamic ContentId
var message = Message.Builder()
.From("sender@example.com", "Joe Sender")
.To("recipient@example.com")
.Subject("Test Email")
.Content("Plain text", ContentType.Text)
.Attachment(Attachment.Builder()
.FromFile("C:/temp/logo.png")
.DispositionInline(out string logoId)
.Build())
.Content($"<b>Test</b><br><img src=\"cid:{logoId}\">", ContentType.Html)
.Build();Custom ContentId
var message = Message.Builder()
.From("sender@example.com", "Joe Sender")
.To("recipient@example.com")
.Subject("Test Email")
.Content("Plain text", ContentType.Text)
.Attachment(Attachment.Builder()
.FromFile("C:/temp/logo.png")
.DispositionInline("logo")
.Build())
.Content("<b>Test</b><br><img src=\"cid:logo\">", ContentType.Html)
.Build();How to Upgrade
Update via NuGet:
dotnet add package Proofpoint.SecureEmailRelay.Mail --version 1.1.0
Links
NuGet Package
Source Code
Documentation
Full Changelog: v1.0.2...v1.1.0