Indicates if the message has any attachments.
true if the message has at least one attachment; otherwise, false.
If only the headers of the message were received from the mail server, this property may not be 100% accurate. The developer should download the entire message to be sure if it really has any attachments or not.
This sample downloads the message from the specified POP3 account and displays the number of the message attachments.
[C#] using System; using MailBee; using MailBee.Pop3Mail; using MailBee.Mime; class Sample { static void Main(string[] args) { // Download the first mail message from the specified POP3 account. MailMessage msg = Pop3.QuickDownloadMessage("pop3.mail.com", "kathy1981", "password", 1); // Check if the mail message has any attachments and display the corresponding message. if (msg.HasAttachments) { Console.WriteLine("This message has " + msg.Attachments.Count.ToString() + " attachments"); } else { Console.WriteLine("This message does not have any attachments"); } } }
[Visual Basic] Imports System Imports MailBee Imports MailBee.Pop3Mail Imports MailBee.Mime Module Sample Sub Main(ByVal args As String()) ' Download the first mail message from the specified POP3 account. Dim msg As MailMessage = Pop3.QuickDownloadMessage("pop3.mail.com", "kathy1981", "password", 1) ' Check if the mail message has any attachments and display the corresponding message. If msg.HasAttachments Then Console.WriteLine("This message has " & msg.Attachments.Count.ToString() & " attachments") Else Console.WriteLine("This message does not have any attachments") End If End Sub End Module
MailMessage Class | MailBee.Mime Namespace