Skip to content

v1.1.0

Choose a tag to compare

@ludvikjerabek ludvikjerabek released this 24 Feb 01:16
· 7 commits to master since this release
8108d8d

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—chain From(), To(), Content(), Attachment(), etc., in any order.
    • Added Attachment.Builder() for attachment creation—chain FromFile(), FromBytes(), FromBase64(), and DispositionInline().
  • 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 specific ContentId—e.g., <img src="cid:logo">.
  • Backwards Compatibility:

    • Legacy new Message() and Add*() methods remain functional.
    • Attachment.FromFile(), FromBytes(), FromBase64() marked [Obsolete]—still work but encourage migration to builder.

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