- Get all the messages to an empty database
- Check if ids are already on database and put only missing ids
- Select batch.size messages
- Get information of
- message
- labels
- attachment information
- Mark message as processed
- Create the target.folder
- Get batch.size messages where:
- processed
- not downloaded
- For each message
- Create target.folder.messageId directory
- Fetch label data
- Fetch download data
- Generate index.html from template
- Generate files from download data
- Update attachment table to downloaded
- Update database with downloaded flag
- Create or update index with processed and downloaded messages of target.folder destination