Commit Graph

27 Commits

Author SHA1 Message Date
Javier Callico
04ed2f8ba8 Refactor migrate_folder call to resolve linting issue. 2026-01-31 08:56:10 -05:00
Javier Callico
2952f79be4 Centralize IMAP/Gmail constants and resolve linting errors. 2026-01-31 08:51:54 -05:00
Javier Callico
a17dc5b95d Merge pull request #4 from nmoinvaz/fix/select-folders
Replace manual folder listing with list_selectable_folders utility
2026-01-31 08:28:07 -05:00
Javier Callico
7dc17accda Merge pull request #6 from nmoinvaz/fix/dup-detection
Fix duplicate detection failing with iCloud IMAP
2026-01-31 08:15:52 -05:00
Nathan Moinvaziri
1fc5e13e9d Fix duplicate detection failing with iCloud IMAP
Match on Message-ID only instead of requiring both Message-ID
and exact RFC822.SIZE, which fails when servers modify messages
on storage.
2026-01-28 20:06:30 -08:00
Nathan Moinvaziri
ed52587077 Replace manual folder listing with list_selectable_folders utility
Easily exclude \NoSelect folders and folders whose status is not OK.
2026-01-28 19:12:09 -08:00
Javier Callico
927fff17c7 feat: Add delete destination functionality to sync emails between source and destination (IMAP server or local folder).
- 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.
2026-01-28 19:48:43 -05:00
Javier Callico
965b327332 Fix print statement formatting for apply flags in main function 2026-01-28 18:34:11 -05:00
Javier Callico
127aad7b7f Fix print statement formatting for apply flags in main function 2026-01-28 18:32:55 -05:00
Javier Callico
c3a26c30bf Implement email restoration functionality with Gmail labels support
- 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.
2026-01-28 18:31:19 -05:00
Javier Callico
2c230dcf64 Implement Gmail labels preservation feature and update tests 2026-01-26 19:41:18 -05:00
Javier Callico
bfac175c0b Refactor error handling tests for IMAP operations to improve readability and consistency 2026-01-25 12:43:47 -05:00
Javier Callico
94ea94adc8 Add comprehensive error handling tests for IMAP email operations 2026-01-25 12:42:45 -05:00
Javier Callico
4f38a5f108 Add Codecov badge to README.md for test coverage visibility 2026-01-25 12:18:35 -05:00
Javier Callico
7b4643a641 Enhance CI configuration to include JUnit XML report generation and upload test results to Codecov 2026-01-25 12:14:34 -05:00
Javier Callico
7711b82924 Add workflow_dispatch trigger to CI configuration 2026-01-25 12:08:48 -05:00
Javier Callico
a3b58fd7da Update CI badge and repository clone URL in README.md 2026-01-25 12:02:13 -05:00
Javier Callico
caf83d60c5 Add comprehensive tests for IMAP email counting, migration, and common functionalities
- 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`.
2026-01-25 11:59:34 -05:00
Javier Callico
705cc1548b Add IMAP email backup, migration, counting, and comparison scripts
- 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.
2026-01-25 08:51:41 -05:00
Javier Callico
6e2eabdf5c Prevent circular migration by skipping Trash folder when deletion is enabled 2026-01-25 08:41:42 -05:00
Javier Callico
dea25e6035 Refactor environment variable names from SRC_IMAP_SERVER/DEST_IMAP_SERVER to SRC_IMAP_HOST/DEST_IMAP_HOST for consistency across scripts 2026-01-24 16:12:48 -05:00
Javier Callico
3d8d51fdd2 Add backup script for incremental email backups and filename sanitization 2026-01-24 16:01:14 -05:00
Javier Callico
54958e47a9 Enhance README to clarify Gmail trash folder handling and deletion process 2026-01-24 15:49:26 -05:00
Javier Callico
cd86d11f08 Add trash folder detection and update migration logic to move deleted emails 2026-01-24 15:42:02 -05:00
Javier Callico
3f0fd380b0 Refactor main function to encapsulate argument parsing and improve error handling 2026-01-24 15:27:28 -05:00
Javier Callico
632dca3643 Refactor IMAP migration scripts to support command-line arguments and improve configuration handling 2026-01-24 15:19:43 -05:00
Javier Callico
7e1125159c Initial commit: IMAP migration tools 2026-01-24 10:12:19 -05:00