- Implemented the ability to delete orphan emails from the destination server that are not present in the local backup.
- Introduced new environment variables and command-line arguments to control the deletion behavior.
- Enhanced the restore process to check for and delete orphan emails if the DEST_DELETE option is enabled.
- Added tests to verify the correct behavior of the new deletion functionality in both backup and restore scripts.
- Updated the mock IMAP server to handle fetching of emails based on UID and improved response handling for header fields.
- Added restore_imap_emails.py for restoring emails from local backups to IMAP accounts.
- Implemented loading of labels and flags from a manifest file.
- Added functionality to upload emails while preserving original dates and applying Gmail labels.
- Introduced multithreading for efficient email uploads.
- Created unit tests for email parsing, restoration, and configuration validation.
- Enhanced existing tests for Gmail labels preservation in backup process.
- Implement tests for counting emails in single and multiple folders, including handling of empty folders and error scenarios in `test_count_imap_emails.py`.
- Create tests for environment variable verification, IMAP connection handling, folder normalization, MIME header decoding, and message details extraction in `test_imap_common.py`.
- Develop tests for email migration, including duplicate detection, deletion from source after migration, folder creation on destination, and handling of multiple folders in `test_migrate_imap_emails.py`.
- Introduce a mock IMAP server to facilitate testing of IMAP functionalities in `tools/mock_imap_server.py`.
- Implemented `backup_imap_emails.py` for backing up emails from an IMAP account to local .eml files with features like incremental backup, filename sanitization, and parallel processing.
- Created `compare_imap_folders.py` to compare email counts between source and destination IMAP accounts, providing a detailed report of discrepancies.
- Developed `count_imap_emails.py` to count emails in all folders of an IMAP account, displaying counts per folder and a grand total.
- Introduced `imap_common.py` for shared utility functions across scripts, including connection handling, folder normalization, and message detail fetching.
- Added `migrate_imap_emails.py` for migrating emails from a source to a destination IMAP account, with options for deletion from the source and duplicate detection.