Attachment Class
Represents a mail message attachment.
- Inheritance:
- Attachment
Constructors
Attachment(MediaType, Byte[])
Initializes a new instance of the Attachment class with specified content type and content.
public Attachment(MediaType contentType, byte[] content)
Public Sub New(contentType As MediaType, content As Byte())
Parameters
contentType
- MediaType
The Content-Type header value.
content
- Byte[]
The content.
Exceptions
Content is null.
Attachment(MediaType, Stream)
Initializes a new instance of the Attachment class with specified content type and content.
public Attachment(MediaType contentType, Stream content)
Public Sub New(contentType As MediaType, content As Stream)
Parameters
contentType
- MediaType
The Content-Type header value.
content
- Stream
The content.
Exceptions
Content is null or empty.
Attachment(MediaType, Stream, String)
Initializes a new instance of the Attachment class with specified content type, content and file name.
public Attachment(MediaType contentType, Stream content, string fileName)
Public Sub New(contentType As MediaType, content As Stream, fileName As String)
Parameters
contentType
- MediaType
The Content-Type header value.
content
- Stream
The content.
fileName
- String
File name.
Exceptions
Content is null or empty.
Attachment(Stream, String)
Initializes a new instance of the Attachment class with specified content and file name.
public Attachment(Stream content, string fileName)
Public Sub New(content As Stream, fileName As String)
Parameters
content
- Stream
The content.
fileName
- String
File name.
Exceptions
Content is null or empty.
Attachment(String)
Initializes a new instance of the Attachment class from specified file.
Parameters
filePath
- String
A relative or absolute path for the file.
Exceptions
File path is null or empty.
Properties
ContentId
Gets or sets the attachment content id.
Property Value
The attachment content id.
Data
Gets the attachment data stream.
Property Value
The attachment data stream.
DispositionType
Gets the attachment content disposition type.
public ContentDispositionType DispositionType { get; }
Public ReadOnly Property DispositionType As ContentDispositionType
Property Value
The attachment content disposition type.
Exceptions
Content disposition type cannot be set to Unknown.
FileName
Gets the file name.
Property Value
The file name, if defined; otherwise, null.
MimeEntity
Gets the underlying MIME entity.
public ContentEntity MimeEntity { get; }
Public ReadOnly Property MimeEntity As ContentEntity
Property Value
The underlying MIME entity.
Size
Gets the data size.