+1 vote

Hello,

when a message not exists in Mail Server I need to have the same behavior on IMAP and POP3.

On POP3, the following command:
pop3.GetMessageByUID(99999)
throws exception and the exception message is "Specified uid was not found (99999)"

On IMAP, the following command:
imap.GetMessageByUID(99999)
returns null value - and it does not throw exception.
Is it safe to say that the message not exists? Is there any other command to identify if the message exists in Mail Server?

Why we do not have same behavior when the message not exists on both protocols?

Thank you

by (1.2k points)

1 Answer

+1 vote

Is it safe to say that the message not exists?

Yes (precisely it means, that server didn't return the message when asked for it by IMAP client).

Why we do not have same behavior when the message not exists on both protocols?

POP3 and IMAP are different.

In IMAP Mail.dll asks for specific UID and gets the response. Null means that the response didn't contain the message.

In POP3 translation from UID to Message Number must be performed on the client side and after that server is asked for specific Message Number.

I think you have a valid point that those two methods should behave the same, however Mail.dll would need to issue additional UIDL command, even when downloading messages by number. As POP3 errors have no codes, it would be almost impossible to implement in a different way.

by (297k points)
edited by
...