2
votes

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?

2
Your command isn't legal. The real command has to include an argument to point to the message. What is the real command? - arnt
Actual command is: "$ FETCH 1 RFC822.SIZE\r\n" - Mayuresh
$ FETCH N RFC822.SIZE\r\n will fetch the size of the Nth message in the mailbox, not the message with a UID of N. If you want to fetch based on UID, then you need to use UID FETCH N RFC822.SIZE\r\n - jstedfast

2 Answers

1
votes

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?

0
votes

If you get no size information back, then it means that the message doesn't exist.