Indicates if the attachment is a file.
true if the attachment is a file; otherwise, false.
If the filename parameter of Content-Disposition header is not empty, attachment is considered to be a file. Some attachments, however, are not files: for instance, antivirus program may add some textual information as an attachment to the message, but this attachment has no filename and is not intended for saving to disk.
This sample loads the message from .EML file and displays filenames of all files attached 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) { // ...when it's a file... if (attach.IsFile) { // ...then show its filename. Console.WriteLine("Attachment " + attach.Filename + " is a file."); } }
[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 ' ...when it's a file... If attach.IsFile Then ' ...then show its filename. Console.WriteLine("Attachment " & attach.Filename & " is a file.") End If Next
Attachment Class | MailBee.Mime Namespace | IsInline