4AspNet POP3 .NET Component

Attachment.TextBody Property

Returns content of attachment if ContentType = "text/plain"

[Visual Basic]
Public ReadOnly Property TextBody As String
[C#]
public string TextBody {get;}

Property Value

Text of attachment if ContentType = "text/plain"

Remarks

Returns null if IsFileAttachment = false

Example

This sample shows how to use the TextBody property

...
for (int i = 1; i <= objPOP3.TotalMailCount; i++)
{
    EmailMessage objEmail = objPOP3.GetMessage(i, false);
    if (objEmail.IsAnyAttachments)
    {
        for(int a = 0; a < objEmail.Attachments.Count; a++)
        {
            Attachment objFile = (Attachment)objEmail.Attachments[a];
            if (!objFile.IsFileAttachment) 
            {
                if (attFile.TextBody != null) 
                    Console.WriteLine("TEXT-BODY: " + attFile.TextBody);
            }
        }
    }
}
...

See Also

Attachment Class | ForAspNet.POP3 Namespace