I'm writing a script that fetches all e-mails from an e-mail address via IMAP.
Currently I'm fetching every folder (mailbox) and saving the highest (fetched) UID from every folder so I start fetching at the highest UID+1 next time I sync. But what if a single folder gets deleted and someone creates a new folder with the same name. The UID is just for a single folder and will be reset.
I can't seem to find any way to find any unique identifier of a mailbox (folder).