Receiving emails using IMAP, receiving deleted messages

I have a mail account with 5000 messages, the old one is 4 years old. I am logged into this account with web and thunderbird. I am deleting very old mail in the web interface. Then I push update (get mail) on thunderbird without chatting. Thunderbird deletes the message immediately. How to quickly detect a deleted thunderbird message? I have to implement such mechanism in java (java mail api), I think I need to get all emails and you have to store already downloaded emails in local, then I have to compare them one by one. As I know, the id property of the message is not secure, so it can be changed, when I move one message to another, they are not secure. The best way is to use the message id stored in the header, or use a custom caching mechanism,as stated in:

Mailing with IMAP: how to tell if a message has been moved from one folder to another?

As a result, how can we report deleted or moved messages so quickly? And how does thunderbird detect new emails? Does it keep the last saved post id? But for deleted old messages or moved messages, the only option is to compare the entire folder with local storage, right?

My idea, I'll check the debug thunderbirds mode and see what's going on at the bottom level.


source to share

1 answer

When the messages are deleted, the server will send a response EXISTS

, after which the client can execute FETCH


to determine which messages were deleted by comparing the UID

message values it has to those on the server. See



All Articles