Mime |
public class MimePart : MimeEntity, IMimePart, IMimeEntity, IDisposable
The MimePart type exposes the following members.
Name | Description | |
---|---|---|
MimePart | Initialize a new instance of the MimePart class with the default Content-Type of application/octet-stream. | |
MimePart(ContentType) | Initialize a new instance of the MimePart class with the specified content type. | |
MimePart(MimeEntityConstructorArgs) | Initialize a new instance of the MimePart class based on the MimeEntityConstructorArgs. | |
MimePart(String) | Initialize a new instance of the MimePart class with the specified content type. | |
MimePart(String, String) | Initialize a new instance of the MimePart class with the specified media type and subtype. | |
MimePart(String, String, Object) | Initialize a new instance of the MimePart class with the specified media type and subtype. |
Name | Description | |
---|---|---|
Content | Get or set the MIME content. | |
ContentBase |
Get or set the base content URI.
(Inherited from MimeEntity) | |
ContentDescription | Get or set the description of the content if available. | |
ContentDisposition |
Get or set the content disposition.
(Inherited from MimeEntity) | |
ContentDuration | Get or set the duration of the content if available. | |
ContentId |
Get or set the Content-Id.
(Inherited from MimeEntity) | |
ContentLocation |
Get or set the content location.
(Inherited from MimeEntity) | |
ContentMd5 | Get or set the md5sum of the content. | |
ContentTransferEncoding | Get or set the content transfer encoding. | |
ContentType |
Get the type of the content.
(Inherited from MimeEntity) | |
FileName | Get or set the name of the file. | |
Headers |
Get the list of headers.
(Inherited from MimeEntity) | |
IsAttachment |
Get a value indicating whether this MimePart is an attachment.
(Inherited from MimeEntity) |
Name | Description | |
---|---|---|
Accept |
Dispatches to the specific visit method for this MIME entity.
(Overrides MimeEntityAccept(MimeVisitor)) | |
ComputeContentMd5 | Compute the MD5 checksum of the content. | |
Dispose |
Releases all resources used by the MimeEntity object.
(Inherited from MimeEntity) | |
Dispose(Boolean) |
Releases the unmanaged resources used by the MimePart and
optionally releases the managed resources.
(Overrides MimeEntityDispose(Boolean)) | |
Equals | (Inherited from Object) | |
Finalize |
Releases unmanaged resources and performs other cleanup operations before the
MimeEntity is reclaimed by garbage collection.
(Inherited from MimeEntity) | |
GetBestEncoding(EncodingConstraint, CancellationToken) | Calculate the most efficient content encoding given the specified constraint. | |
GetBestEncoding(EncodingConstraint, Int32, CancellationToken) | Calculate the most efficient content encoding given the specified constraint. | |
GetHashCode | (Inherited from Object) | |
GetType | (Inherited from Object) | |
MemberwiseClone | (Inherited from Object) | |
OnHeadersChanged |
Called when the headers change in some way.
(Overrides MimeEntityOnHeadersChanged(HeaderListChangedAction, Header)) | |
Prepare |
Prepare the MIME entity for transport using the specified encoding constraints.
(Overrides MimeEntityPrepare(EncodingConstraint, Int32)) | |
RemoveHeader |
Remove a header by name.
(Inherited from MimeEntity) | |
SetHeader(String, Byte) |
Set the value of a header using the raw value.
(Inherited from MimeEntity) | |
SetHeader(String, String) |
Set the value of a header.
(Inherited from MimeEntity) | |
ToString |
Return a String that represents the MimeEntity for debugging purposes.
(Inherited from MimeEntity) | |
TryInit |
Tries to use the given object to initialize the appropriate property.
(Inherited from MimeEntity) | |
VerifyContentMd5 | Verify the Content-Md5 value against an independently computed md5sum. | |
WriteTo(Stream, CancellationToken) |
Write the MimeEntity to the specified output stream.
(Inherited from MimeEntity) | |
WriteTo(String, CancellationToken) |
Write the MimeEntity to the specified file.
(Inherited from MimeEntity) | |
WriteTo(FormatOptions, Stream, CancellationToken) |
Write the MimeEntity to the specified output stream.
(Inherited from MimeEntity) | |
WriteTo(FormatOptions, String, CancellationToken) |
Write the MimeEntity to the specified file.
(Inherited from MimeEntity) | |
WriteTo(Stream, Boolean, CancellationToken) |
Write the MimeEntity to the specified output stream.
(Inherited from MimeEntity) | |
WriteTo(String, Boolean, CancellationToken) |
Write the MimeEntity to the specified file.
(Inherited from MimeEntity) | |
WriteTo(FormatOptions, String, Boolean, CancellationToken) |
Write the MimeEntity to the specified file.
(Inherited from MimeEntity) | |
WriteTo(FormatOptions, Stream, Boolean, CancellationToken) |
Write the MimePart to the specified output stream.
(Overrides MimeEntityWriteTo(FormatOptions, Stream, Boolean, CancellationToken)) | |
WriteToAsync(Stream, CancellationToken) |
Asynchronously write the MimeEntity to the specified output stream.
(Inherited from MimeEntity) | |
WriteToAsync(String, CancellationToken) |
Asynchronously write the MimeEntity to the specified file.
(Inherited from MimeEntity) | |
WriteToAsync(FormatOptions, Stream, CancellationToken) |
Asynchronously write the MimeEntity to the specified output stream.
(Inherited from MimeEntity) | |
WriteToAsync(FormatOptions, String, CancellationToken) |
Asynchronously write the MimeEntity to the specified file.
(Inherited from MimeEntity) | |
WriteToAsync(Stream, Boolean, CancellationToken) |
Asynchronously write the MimeEntity to the specified output stream.
(Inherited from MimeEntity) | |
WriteToAsync(String, Boolean, CancellationToken) |
Asynchronously write the MimeEntity to the specified file.
(Inherited from MimeEntity) | |
WriteToAsync(FormatOptions, String, Boolean, CancellationToken) |
Asynchronously write the MimeEntity to the specified file.
(Inherited from MimeEntity) | |
WriteToAsync(FormatOptions, Stream, Boolean, CancellationToken) |
Asynchronously write the MimePart to the specified output stream.
(Overrides MimeEntityWriteToAsync(FormatOptions, Stream, Boolean, CancellationToken)) |
foreach (var attachment in message.Attachments) { if (attachment is MessagePart) { var fileName = attachment.ContentDisposition?.FileName; var rfc822 = (MessagePart) attachment; if (string.IsNullOrEmpty (fileName)) fileName = "attached-message.eml"; using (var stream = File.Create (fileName)) rfc822.Message.WriteTo (stream); } else { var part = (MimePart) attachment; var fileName = part.FileName; using (var stream = File.Create (fileName)) part.Content.DecodeTo (stream); } }