Provides properties and methods for managing and examining the collection of Attachment objects.
For a list of all members of this type, see AttachmentCollection Members.
System.Object
System.Collections.CollectionBase
MailBee.Mime.AttachmentCollection
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
This collection represents all attachments of the mail message. It's available through Attachments property of MailMessage object. GetAttachmentsFromTnef method can also return AttachmentCollection.
This sample loads the message from .EML file and saves all attachments to the disk.
[C#] // To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.Mime; // The actual code (put it into a method of your class) // Load the message from file. MailMessage msg = new MailMessage(); msg.LoadMessage(@"C:\Docs\TestMail.eml"); // For every attachment from the attachments collection... foreach (Attachment attach in msg.Attachments) { // Save the attachment to the file. attach.Save(@"C:\Temp\" + attach.Name, true); }
[Visual Basic] ' To use the code below, import MailBee namespaces at the top of your code. Imports MailBee Imports MailBee.Mime ' The actual code (put it into a method of your class) ' Load the message from file. Dim msg As New MailMessage msg.LoadMessage("C:\Docs\TestMail.eml") ' For every attachment from the attachments collection... For Each attach As Attachment In msg.Attachments ' Save the attachment to the file. attach.Save("C:\Temp\" & attach.Name, True) Next
Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll)
AttachmentCollection Members | MailBee.Mime Namespace