redb.Route.DataFormats.Mime 4.7.2

Prefix Reserved
dotnet add package redb.Route.DataFormats.Mime --version 4.7.2
                    
NuGet\Install-Package redb.Route.DataFormats.Mime -Version 4.7.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="redb.Route.DataFormats.Mime" Version="4.7.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="redb.Route.DataFormats.Mime" Version="4.7.2" />
                    
Directory.Packages.props
<PackageReference Include="redb.Route.DataFormats.Mime" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add redb.Route.DataFormats.Mime --version 4.7.2
                    
#r "nuget: redb.Route.DataFormats.Mime, 4.7.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package redb.Route.DataFormats.Mime@4.7.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=redb.Route.DataFormats.Mime&version=4.7.2
                    
Install as a Cake Addin
#tool nuget:?package=redb.Route.DataFormats.Mime&version=4.7.2
                    
Install as a Cake Tool

redb.Route.DataFormats.Mime

MIME multipart as a redb.Route data format, on MimeKit: Apache Camel's mimeMultipart, with a form mode for multipart/form-data. The files of a form or of a multipart/mixed body become message attachments, so the same route can send them on with smtp: or store them.

context.AddMimeMultipartDataFormat();          // multipart/form-data; builder.AddMimeMultipartDataFormat() with DI

From("http://0.0.0.0:8080/claims")
    .ConvertBody<FormBody>()                   // driven by the request Content-Type
    .SetHeader("claim", e => ((FormBody)e.In.Body!).Get("claim"))
    .Filter("attachments.size > 0")
    .To("smtp://mail.example.com?to=claims@example.com");

// per-node, without registering
.UnmarshalMimeMultipart()
.MarshalMimeMultipart(o => o.SubType = "mixed")

Unmarshal

Body Result
not multipart/* (by the message content type or its Content-Type header) unchanged, as Camel does
multipart/form-data body: FormBody with every field in order, repeated names kept (or Dictionary<string, string>, first value of each name); attachments: every part with a file name, named by that file name, part headers kept (the form field is in Content-Disposition); content type removed
any other multipart/* body: the first part as byte[], string or a Stream, its type as the content type; attachments: the other parts, named by file name, then Content-ID, then a generated id
  • The boundary comes from the content type; without one, from the first line of the body.
  • File names lose their directory (C:\docs\a.pdf and ../a.pdf give a.pdf) and line breaks; a storage key is still the route's decision.
  • filename and filename* (RFC 2231), quoted-printable and base64 parts are decoded; raw UTF-8 names from browsers are read as UTF-8.
  • A nested multipart or a message/rfc822 part stays one attachment with its bytes.
  • Parts are spooled to a StreamCache with the engine's stream cache options, so a large file does not stay in memory. The cache is released with the exchange: store or send the files before it ends (an http: consumer ends it once the response is written).

Marshal

SubType Body in Out
form-data (default) FormBody, string pairs or no body, plus the attachments multipart/form-data: one field per pair, one file part per attachment (field name from its Content-Disposition, else its name)
mixed byte[], string or Stream with the message content type, plus the attachments multipart/mixed: the body first, then the attachments; without attachments the body is left as it is unless MultipartWithoutAttachment

A new boundary per message goes into the content type and the Content-Type header, so http: sends it as it is. The body becomes a StreamCache; the attachments stay on the message.

Options

Option Default
SubType form-data what Marshal writes and the format registers under: form-data or mixed
MultipartWithoutAttachment false mixed: write a multipart without attachments
MaxParts 1000 parts in one body
MaxPartBytes 10 MB one decoded part
MaxTotalBytes 32 MB the body as it arrives
MaxFileNameLength 255 characters of a file name
DefaultCharset UTF-8 fields and headers that declare none

The limits hold wherever the body comes from, not only behind a web server; a body over a limit fails the step with InvalidDataException naming the limit. multipart/related is never registered: it belongs to SOAP MTOM.

XML form: register in context.xml with <dataFormat type="redb.Route.DataFormats.Mime.MimeMultipartDataFormat, redb.Route.DataFormats.Mime"/>, then <convertBody type="redb.Route.Serialization.FormBody, redb.Route"/> or <marshal format="multipart/form-data"/>.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.7.2 44 11/13/2026
4.7.1 51 11/11/2026
4.7.0 92 11/7/2026
4.6.2 94 11/5/2026
4.6.1 88 11/4/2026
4.6.0 88 11/3/2026
4.5.1 101 10/30/2026
4.5.0 101 10/29/2026