Search code examples
c#asp.netopenpop

How to retrieve size of each attachment of mail using openpop .net


I use openpop .net library to retrieve mails from mail server with POP3. All works fine but I can't retrieve size of each attachment of mail. I founded GetMessageSize(i) but this size is sum of all attachments.

Then the question is how I can retrieve size of each attachment.

Can anybody help me? Thanks!


Solution

  • Use attachment.Body.

    foreach(var attachment in message.FindAllAttachments())
    {
        long byteSize = attachment.Body.Length;
    }