Commit graph

7 commits

Author SHA1 Message Date
02f6461cbc Rename main.py to email_forwarder.py and fix systemd variable expansion
- Rename main.py to email_forwarder.py for better readability
- Update systemd service to use  in ExecStart and EnvironmentFile,
  remove WorkingDirectory to fix expansion issues
- Update install.sh and README references
- Drop-in sets PROJECT_DIR for runtime expansion

Changes:
- File rename: main.py -> email_forwarder.py
- Service: ExecStart and EnvironmentFile now use
- Docs: Updated to reflect new script name
2026-01-04 18:16:37 +09:00
9b7a6c5c07 Improve code style in load_state
Replace duplicate strip() calls with filter(None, generator) for
cleaner and more efficient processing of processed Message-IDs.

Changes:
- Use set(filter(None, (line.strip() for line in f))) to avoid calling
  strip() twice and filter empty lines
2026-01-04 16:54:13 +09:00
f2bc700939 Improve encapsulation in IMAP classes
Make all attributes private (_host, _imap, etc.) and remove redundant
public connect/disconnect methods. Connection management is now handled
internally by the orchestrator calling private _connect/_disconnect.

Changes:
- Privatize ImapClient attributes and methods
- Update EmailForwarder to call private connection methods
- Enhance encapsulation without changing functionality
2026-01-04 16:48:57 +09:00
f70f1853f0 Refactor main.py for readability and maintainability
Introduce class-based architecture with inheritance for IMAP clients:
- ImapClient base class with private low-level methods
- SourceImap and DestImap subclasses for specific operations
- EmailForwarder orchestrator class for coordination
- Global load_config and main functions

Improvements:
- Clear separation of concerns and encapsulation
- Private methods for internal IMAP calls
- Better error handling and logging
- Maintains all original functionality
2026-01-04 16:41:58 +09:00
485a5db8b9 Implement multi-folder synchronization
Add support for syncing multiple IMAP folders with auto-creation of missing
dest folders and configurable folder selection.

Changes:
- Update main.py to loop over folders, with auto-create for dest
- Add FOLDERS env var for all or specific folders
- Update .env.example and README for FOLDERS config
2026-01-04 16:27:54 +09:00
45b179ede3 Clean up unused code and config
Remove PROCESSED_FILE references and update .env.example with placeholder
Uptime URLs for privacy.

Changes:
- Remove unused processed_file variable and loading in main.py
- Update .env.example to use generic Uptime URLs
- Remove processed_uids.txt from .gitignore
2026-01-04 15:44:57 +09:00
686c4877d3 Implement email forwarder
Add core IMAP forwarding logic with time-based searches and Message-ID
deduplication to prevent duplicates in destination mailbox.

Changes:
- Implement SINCE-based email search using last_run.txt for incremental forwarding
- Add Message-ID extraction and IMAP checks for deduplication
- Configure systemd user services with drop-in overrides for portability
- Integrate Uptime Kuma pings for monitoring
- Set up virtual environment for dependency isolation
- Update documentation and configuration templates
2026-01-04 15:34:31 +09:00