Check attachment file sizes before download the email

Hi Apose,

Is there a way to check the attachment file sizes before download the email from server using pop, imap & mapi?


Thanks for writing to Aspose.Email support team.

Aspose.Email has provided this feature with newly updated ExchangeWebServiceClient where attachments info collection can be obtained for a message. This attachment info contains lot of information including the size in bytes for the individual attachment. Please have a look at the following code where this feature is demonstrated. In this code snippet, it is assumed that there is atleast one message with one or more attachments in the Inbox.

const string mailboxUri = “[https://MailboxUrl.asmx](https://mailboxurl.asmx/)”;
const string domain = “”;
const string username = “user”;
const string password = “pwd”;
NetworkCredential credential = new NetworkCredential(username, password, domain);
IEWSClient client = EWSClient.GetEWSClient(mailboxUri, credentials);
ExchangeMessageInfoCollection coll = client.ListMessages(“Inbox”);
ExchangeAttachmentInfoCollection attchColl = coll[0].Attachments;
int iAttachSize = attchColl[0].Size;

I would like to share that this feature is not available with pop, imap and mapi. Please feel free to write us back if you have any other query in this regard.