MailMessageHasAttachments Property
Indicates if the message has any attachments.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.2.0 build 630 for .NET 4.5
public bool HasAttachments { get; }

Property Value

Type: Boolean
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.
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("", "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");
            Console.WriteLine("This message does not have any attachments");
See Also