I have an application that is used to archive emails using imap. Also in this application are many imap accounts that need to be archived.
In this moment from time to time the application connects to imap accounts and download only new emails. My issue is that every time when it connects to an imap account it verifies all emails from all folders and downloads only emails that aren't downloaded yet (I store Message-ID for all emails and download only emails that have an Message-ID that is not stored). So I want to know if there is an alternative for this, because it takes some time to verify all emails (for 10-20K it takes 2-5 minutes).
I use JavaMail API to connect to imap accounts.
A similar issue can be solved by going to Account Settings, your default account, More Settings, and Advanced. Find the “leave a copy of messages on the server” and remove the check. Note that this can make old messages inaccessible, so make sure your message archives are backed up.
Choose received in a specific date span Click the underlined words and tick Before: [date]. Choose yesterday's date if you haven't downloaded mail yet today. Click Ok then Next. On the actions page, select either move to the specified folder then select the folder or permanently delete it.
You can save your backup IMAP email in any form like PST, EML, MSG, MHT, HTML, DOC, DOCX, and PDF.
Users can take backup of unlimited emails and can download selective emails from the IMAP account. Moreover, all the files and folders will appear on the screen, so users can directly select data. The software enables you to download all emails from IMAP server into any desired file format.
The javadoc helps:
IMAPFolder provides the methods:
getMessagesByUID(long start, long end) and
getUID(Message message)
With getUID() you can get the UID of the last message you already have downloaded. With getMessagesByUID you can define this last message you have downloaded as start-range and look with the method getUIDNext() to find the last message which would be the end of the range.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With