MailBee.NET Objects 4.0

MimePart.IsComplete Property

Indicates whether the MIME part of the message was received completely.

public bool IsComplete {get;}

Property Value

true if the MIME part was received completely; otherwise, false.

Remarks

If the message was received partially, this property may return false for some MIME parts of the message.

MailBee tests if the MIME part is complete by checking if the closing boundary was found. This, however, works for multi-part messages only. If the message consists of a single part and does not include any boundaries, it's not possible to determine if the part was received completely. However, in this case you can check MailMessage.SizeOnServer property. If its value is larger than MailMessage.Size, the message was incompletely received from the mail server.

Example

This sample loads the message from file and checks if all MIME parts of this message were received entirely.

[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).
MailMessage msg = new MailMessage();
msg.LoadMessage(@"C:\Docs\TestMail.eml");
bool allPartsAreComplete = true;
foreach (MimePart part in msg.MimePartTree.GetAllParts())
{
    if (!part.IsComplete)
    {
        allPartsAreComplete = false;
        break;
    }
}
if (allPartsAreComplete)
{
    Console.WriteLine("allPartsAreComplete == true");
}
else
{
    Console.WriteLine("allPartsAreComplete == false");
}
[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).
Dim msg As New MailMessage
msg.LoadMessage("C:\Docs\TestMail.eml")
Dim allPartsAreComplete As Boolean = True
For Each part As MimePart In msg.MimePartTree.GetAllParts()
    If Not part.IsComplete Then
        allPartsAreComplete = False
        Exit For
    End If
Next
If allPartsAreComplete Then
    Console.WriteLine("allPartsAreComplete = True")
Else
    Console.WriteLine("allPartsAreComplete = False")
End If

See Also

MimePart Class | MailBee.Mime Namespace | IsEntire | SizeOnServer