Class Attachment
One attachment of a message (Apache Camel's Attachment): a named piece of content that travels beside the body,
such as a file of a multipart/form-data upload, a mail attachment or an MTOM part. Immutable: replace it on the
message with .
public sealed class Attachment
Inheritance
Properties
Content
The content, readable as often as needed.
public required AttachmentContent Content { get; init; }
ContentId
MIME Content-ID without the angle brackets, for parts referenced as cid:.
public string? ContentId { get; init; }
FileName
Original file name, without a directory, when the attachment came as a file.
public string? FileName { get; init; }
Headers
Headers of the MIME part the attachment came from; empty when it did not come from one.
public IReadOnlyDictionary<string, string> Headers { get; init; }
Length
Length of the content in bytes (attachments[0].length in an expression).
public long Length { get; }
Name
The key the message finds the attachment by: the file name, the form field name or the Content-ID,
public required string Name { get; init; }
Methods
WithContent(AttachmentContent)
A copy of this attachment with other content (the metadata stays).
public Attachment WithContent(AttachmentContent content)
Remarks
The text fields end up in MIME headers when a producer writes the attachment, so a carriage return or line feed in
any of them is rejected here rather than written onto the wire.