AttachmentIsMessageInside Property
Indicates if the attachment contains a mail message.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax
public bool IsMessageInside { get; }

Property Value

Type: Boolean
true if the attachment is a mail message; otherwise, false.
Remarks
For instance, if the mail message was forwarded as attachment to another message, the developer can use this property to determine whether the attachment contains the forwarded message. If it does, GetEncapsulatedMessage method can be used to extract the encapsulated MailMessage object from the attachment.
Examples
This sample loads the message from .EML file and displays subjects of all attached e-mails.
// 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 the attachment is an e-mail message...
    if (attach.IsMessageInside)
    {
        // ...then extract the e-mail message from the attachment...
        MailMessage attachedMsg = attach.GetEncapsulatedMessage();

        // and show its Subject field.
        Console.WriteLine("Forwarded message subject is " + attachedMsg.Subject);
    }
}
See Also