Search code examples
c#imap

Fetching size of message using IMAP command


I am fetching the size of message using following IMAP command.

"$ FETCH UID RFC822.SIZE\r\n"

For some messages the command works properly and returns the message size

"* 3 FETCH (RFC822.SIZE 2376)\r\n$ OK Success\r\n"

But for some emails its not fetching the size of message. It returns only Success message but not the size

Here is the response for some messages.

"$ OK Success\r\n"

Is there any alternative way for fetching the size of message?


Solution

  • Stepping out on a limb... what you have in mind is x uid fetch 1234 rfc822.size in order to learn the size of the message with UID 1234. However, what you send is y fetch 1234 rfc822.size, and if there are fewer than 1234 messages in the mailbox that command will not work.

    Am I guessing correctly?