![]() | AttachmentCollection Class |
Namespace: MimeKit
public class AttachmentCollection : IList<MimeEntity>, ICollection<MimeEntity>, IEnumerable<MimeEntity>, IEnumerable
The AttachmentCollection type exposes the following members.
Name | Description | |
---|---|---|
![]() | AttachmentCollection |
Initialize a new instance of the AttachmentCollection class.
|
![]() | AttachmentCollection(Boolean) |
Initialize a new instance of the AttachmentCollection class.
|
Name | Description | |
---|---|---|
![]() | Count |
Gets the number of attachments currently in the collection.
|
![]() | IsReadOnly |
Gets whther or not the collection is read-only.
|
![]() | Item |
Get or set the MimeEntity at the specified index.
|
Name | Description | |
---|---|---|
![]() | Add(MimeEntity) |
Add the specified attachment.
|
![]() | Add(String, Byte) |
Add the specified attachment.
|
![]() ![]() | Add(String, CancellationToken) |
Add the specified attachment.
|
![]() | Add(String, ContentType, CancellationToken) |
Add the specified attachment.
|
![]() | Add(String, Byte, ContentType) |
Add the specified attachment.
|
![]() | Add(String, Stream, CancellationToken) |
Add the specified attachment.
|
![]() | Add(String, Stream, ContentType, CancellationToken) |
Add the specified attachment.
|
![]() | AddAsync(String, CancellationToken) |
Asynchronously add the specified attachment.
|
![]() | AddAsync(String, ContentType, CancellationToken) |
Asynchronously add the specified attachment.
|
![]() | AddAsync(String, Stream, CancellationToken) |
Asynchronously add the specified attachment.
|
![]() | AddAsync(String, Stream, ContentType, CancellationToken) |
Asynchronously add the specified attachment.
|
![]() | Clear |
Clears the attachment collection.
|
![]() | Clear(Boolean) |
Clears the attachment collection.
|
![]() | Contains |
Checks if the collection contains the specified attachment.
|
![]() | CopyTo |
Copies all of the attachments in the collection to the specified array.
|
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetEnumerator |
Gets an enumerator for the list of attachments.
|
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | IndexOf |
Gets the index of the requested attachment, if it exists.
|
![]() | Insert |
Inserts the specified attachment at the given index.
|
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | Remove |
Removes the specified attachment.
|
![]() | RemoveAt |
Removes the attachment at the specified index.
|
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
var message = new MimeMessage (); message.From.Add (new MailboxAddress ("Joey", "joey@friends.com")); message.To.Add (new MailboxAddress ("Alice", "alice@wonderland.com")); message.Subject = "How you doin?"; var builder = new BodyBuilder (); // Set the plain-text version of the message text builder.TextBody = @"Hey Alice, What are you up to this weekend? Monica is throwing one of her parties on Saturday and I was hoping you could make it. Will you be my +1? -- Joey "; // In order to reference selfie.jpg from the html text, we'll need to add it // to builder.LinkedResources and then use its Content-Id value in the img src. var image = builder.LinkedResources.Add (@"C:\Users\Joey\Documents\Selfies\selfie.jpg"); image.ContentId = MimeUtils.GenerateMessageId (); // Set the html version of the message text builder.HtmlBody = string.Format (@"<p>Hey Alice,<br> <p>What are you up to this weekend? Monica is throwing one of her parties on Saturday and I was hoping you could make it.<br> <p>Will you be my +1?<br> <p>-- Joey<br> <center><img src=""cid:{0}""></center>", image.ContentId); // We may also want to attach a calendar event for Monica's party... builder.Attachments.Add (@"C:\Users\Joey\Documents\party.ics"); // Now we just need to set the message body and we're done message.Body = builder.ToMessageBody ();