This project is read-only.

IMAP fetch RFC822.SIZE command

Dec 1, 2014 at 4:32 PM
Hi!

I'm trying to define the size of the mail message, but I cant figure out how to send such command as "fetch RFC822.SIZE" using imap. I know that i can get message size after it downloading, but I dont need to download it. I found ImapClient.ExecuteFecth(long mailindex) method, but i can't understand, what to deal with it.
Dec 1, 2014 at 11:41 PM
Hi.

Please use GetMessageSizes method of ImapClient object.

regards.
Dec 2, 2014 at 9:29 AM
I'm sorry, but I still cant resolve problem. I have format exception when trying
static void GetSize(ImapClient icl, string folder, bool newOnly = true)
        {
            ImapFolder ifolder = icl.SelectFolder(folder);

            SearchResult messageList;
            if (newOnly)
                messageList = icl.ExecuteSearch("UNSEEN UNDELETED");
            else
                messageList = icl.ExecuteSearch("UNDELETED");

            if (messageList.MailIndexList.Count < 1)
            {
                Console.WriteLine("No messages"); return;
            }

            var mssizes = icl.GetMessageSizes(1, 1); -> Here is format exeption, I'm trying GetMessageSizes(0, 0) or GetMessageSizes(1, 4) etc...

        }