MailBee.NET Objects 3.1

Attachment Class

Provides properties and methods for constructing or examining a single attachment to the mail message.

For a list of all members of this type, see Attachment Members.

System.Object
   MailBee.Mime.Attachment

public class Attachment

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

All the attachments to the message (including embedded pictures) are stored in Attachments collection of the MailMessage object.

Example

This sample loads the message from .EML file and displays filenames of all attachments to this message.

[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...
foreach (Attachment attach in msg.Attachments)
{
    // ...show the filename of the attachment.
    Console.WriteLine("Attachment name is " + attach.Filename);
}
[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...
For Each attach As Attachment In msg.Attachments
    ' ...show the filename of the attachment.
    Console.WriteLine("Attachment name is " & attach.Filename)
Next

Requirements

Namespace: MailBee.Mime

Assembly: MailBee.NET (in MailBee.NET.dll)

See Also

Attachment Members | MailBee.Mime Namespace | AttachmentCollection