2025-08-01 17:04:10 +02:00
|
|
|
# mail2couch Test Environment
|
|
|
|
|
|
|
|
|
|
This directory contains a complete test environment for mail2couch using Podman containers.
|
|
|
|
|
|
|
|
|
|
## Overview
|
|
|
|
|
|
|
|
|
|
The test environment provides:
|
|
|
|
|
- **CouchDB**: Database for storing email messages
|
|
|
|
|
- **GreenMail IMAP Server**: Java-based mail server designed for testing with pre-populated test accounts and messages
|
|
|
|
|
- **Test Configuration**: Ready-to-use config for testing both sync and archive modes
|
2025-08-02 14:57:51 +02:00
|
|
|
- **HTML Webmail Interface**: Beautiful, responsive web interface for viewing archived emails
|
2025-08-01 17:04:10 +02:00
|
|
|
|
|
|
|
|
## Quick Start
|
|
|
|
|
|
feat: add comprehensive README documentation and clean up configuration
## Documentation Enhancements
- Create comprehensive README with installation, configuration, and usage examples
- Add simple, advanced, and provider-specific configuration examples
- Document all features: incremental sync, wildcard patterns, keyword filtering, attachment support
- Include production deployment guidance and troubleshooting section
- Add architecture documentation with database structure and document format examples
## Configuration Cleanup
- Remove unnecessary `database` field from CouchDB configuration
- Add `m2c_` prefix to all CouchDB database names for better namespace isolation
- Update GenerateAccountDBName() to consistently prefix databases with `m2c_`
- Clean up all configuration examples to remove deprecated database field
## Test Environment Simplification
- Simplify test script structure to eliminate confusion and redundancy
- Remove redundant populate-test-messages.sh wrapper script
- Update run-tests.sh to be comprehensive automated test with cleanup
- Maintain clear separation: automated tests vs manual testing environment
- Update all test scripts to expect m2c-prefixed database names
## Configuration Examples Added
- config-simple.json: Basic single Gmail account setup
- config-advanced.json: Multi-account with complex filtering and different providers
- config-providers.json: Real-world configurations for Gmail, Outlook, Yahoo, iCloud
## Benefits
- Clear documentation for users from beginner to advanced
- Namespace isolation prevents database conflicts in shared CouchDB instances
- Simplified test workflow eliminates user confusion about which scripts to use
- Comprehensive examples cover common email provider configurations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 21:26:53 +02:00
|
|
|
### Run Basic Integration Tests
|
2025-08-01 17:04:10 +02:00
|
|
|
```bash
|
|
|
|
|
./run-tests.sh
|
|
|
|
|
```
|
feat: add comprehensive README documentation and clean up configuration
## Documentation Enhancements
- Create comprehensive README with installation, configuration, and usage examples
- Add simple, advanced, and provider-specific configuration examples
- Document all features: incremental sync, wildcard patterns, keyword filtering, attachment support
- Include production deployment guidance and troubleshooting section
- Add architecture documentation with database structure and document format examples
## Configuration Cleanup
- Remove unnecessary `database` field from CouchDB configuration
- Add `m2c_` prefix to all CouchDB database names for better namespace isolation
- Update GenerateAccountDBName() to consistently prefix databases with `m2c_`
- Clean up all configuration examples to remove deprecated database field
## Test Environment Simplification
- Simplify test script structure to eliminate confusion and redundancy
- Remove redundant populate-test-messages.sh wrapper script
- Update run-tests.sh to be comprehensive automated test with cleanup
- Maintain clear separation: automated tests vs manual testing environment
- Update all test scripts to expect m2c-prefixed database names
## Configuration Examples Added
- config-simple.json: Basic single Gmail account setup
- config-advanced.json: Multi-account with complex filtering and different providers
- config-providers.json: Real-world configurations for Gmail, Outlook, Yahoo, iCloud
## Benefits
- Clear documentation for users from beginner to advanced
- Namespace isolation prevents database conflicts in shared CouchDB instances
- Simplified test workflow eliminates user confusion about which scripts to use
- Comprehensive examples cover common email provider configurations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 21:26:53 +02:00
|
|
|
This comprehensive test will:
|
|
|
|
|
1. Start all containers with cleanup
|
|
|
|
|
2. Populate test data
|
|
|
|
|
3. Build and run mail2couch
|
|
|
|
|
4. Verify database creation and document storage
|
|
|
|
|
5. Test incremental sync behavior
|
|
|
|
|
6. Clean up automatically
|
2025-08-01 17:04:10 +02:00
|
|
|
|
feat: implement comprehensive wildcard folder selection and keyword filtering
## Wildcard Folder Selection
- Add support for wildcard patterns (`*`, `?`, `[abc]`) using filepath.Match
- Implement special case: `"*"` selects ALL available folders
- Support for complex include/exclude pattern combinations
- Maintain backwards compatibility with exact string matching
- Enable subfolder pattern matching (e.g., `Work/*`, `*/Drafts`)
## Keyword Filtering
- Add SubjectKeywords, SenderKeywords, RecipientKeywords to MessageFilter config
- Implement case-insensitive keyword matching across message fields
- Support multiple keywords per filter type with inclusive OR logic
- Add ShouldProcessMessage method for message-level filtering
## Enhanced Test Environment
- Create comprehensive wildcard pattern test scenarios
- Add 12 test folders covering various pattern types: Work/*, Important/*, Archive/*, exact matches
- Implement dedicated wildcard test script (test-wildcard-patterns.sh)
- Update test configurations to demonstrate real-world wildcard usage patterns
- Enhance test data generation with folder-specific messages for validation
## Documentation
- Create FOLDER_PATTERNS.md with comprehensive wildcard examples and use cases
- Update CLAUDE.md to reflect all implemented features and current status
- Enhance test README with detailed wildcard pattern explanations
- Provide configuration examples for common email organization scenarios
## Message Origin Tracking
- Verify all messages in CouchDB properly tagged with origin folder in `mailbox` field
- Maintain per-account database isolation for better organization
- Document ID format: `{folder}_{uid}` ensures uniqueness across folders
Key patterns supported:
- `["*"]` - All folders (with excludes)
- `["Work*", "Important*"]` - Prefix matching
- `["Work/*", "Archive/*"]` - Subfolder patterns
- `["INBOX", "Sent"]` - Exact matches
- Complex include/exclude combinations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 17:24:02 +02:00
|
|
|
### Run Wildcard Pattern Tests
|
|
|
|
|
```bash
|
|
|
|
|
./test-wildcard-patterns.sh
|
|
|
|
|
```
|
|
|
|
|
This will test various wildcard folder patterns including:
|
|
|
|
|
- `*` (all folders)
|
|
|
|
|
- `Work*` (prefix patterns)
|
|
|
|
|
- `*/Drafts` (subfolder patterns)
|
|
|
|
|
- Complex include/exclude combinations
|
|
|
|
|
|
feat: add comprehensive README documentation and clean up configuration
## Documentation Enhancements
- Create comprehensive README with installation, configuration, and usage examples
- Add simple, advanced, and provider-specific configuration examples
- Document all features: incremental sync, wildcard patterns, keyword filtering, attachment support
- Include production deployment guidance and troubleshooting section
- Add architecture documentation with database structure and document format examples
## Configuration Cleanup
- Remove unnecessary `database` field from CouchDB configuration
- Add `m2c_` prefix to all CouchDB database names for better namespace isolation
- Update GenerateAccountDBName() to consistently prefix databases with `m2c_`
- Clean up all configuration examples to remove deprecated database field
## Test Environment Simplification
- Simplify test script structure to eliminate confusion and redundancy
- Remove redundant populate-test-messages.sh wrapper script
- Update run-tests.sh to be comprehensive automated test with cleanup
- Maintain clear separation: automated tests vs manual testing environment
- Update all test scripts to expect m2c-prefixed database names
## Configuration Examples Added
- config-simple.json: Basic single Gmail account setup
- config-advanced.json: Multi-account with complex filtering and different providers
- config-providers.json: Real-world configurations for Gmail, Outlook, Yahoo, iCloud
## Benefits
- Clear documentation for users from beginner to advanced
- Namespace isolation prevents database conflicts in shared CouchDB instances
- Simplified test workflow eliminates user confusion about which scripts to use
- Comprehensive examples cover common email provider configurations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 21:26:53 +02:00
|
|
|
### Run Incremental Sync Tests
|
2025-08-01 17:04:10 +02:00
|
|
|
```bash
|
feat: add comprehensive README documentation and clean up configuration
## Documentation Enhancements
- Create comprehensive README with installation, configuration, and usage examples
- Add simple, advanced, and provider-specific configuration examples
- Document all features: incremental sync, wildcard patterns, keyword filtering, attachment support
- Include production deployment guidance and troubleshooting section
- Add architecture documentation with database structure and document format examples
## Configuration Cleanup
- Remove unnecessary `database` field from CouchDB configuration
- Add `m2c_` prefix to all CouchDB database names for better namespace isolation
- Update GenerateAccountDBName() to consistently prefix databases with `m2c_`
- Clean up all configuration examples to remove deprecated database field
## Test Environment Simplification
- Simplify test script structure to eliminate confusion and redundancy
- Remove redundant populate-test-messages.sh wrapper script
- Update run-tests.sh to be comprehensive automated test with cleanup
- Maintain clear separation: automated tests vs manual testing environment
- Update all test scripts to expect m2c-prefixed database names
## Configuration Examples Added
- config-simple.json: Basic single Gmail account setup
- config-advanced.json: Multi-account with complex filtering and different providers
- config-providers.json: Real-world configurations for Gmail, Outlook, Yahoo, iCloud
## Benefits
- Clear documentation for users from beginner to advanced
- Namespace isolation prevents database conflicts in shared CouchDB instances
- Simplified test workflow eliminates user confusion about which scripts to use
- Comprehensive examples cover common email provider configurations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 21:26:53 +02:00
|
|
|
./test-incremental-sync.sh
|
|
|
|
|
```
|
|
|
|
|
This will test incremental synchronization functionality:
|
|
|
|
|
- First sync establishes baseline
|
|
|
|
|
- New messages are added to test accounts
|
|
|
|
|
- Second sync should only fetch new messages
|
|
|
|
|
- Sync metadata tracking and IMAP SEARCH with SINCE
|
|
|
|
|
|
|
|
|
|
### Manual Testing Environment
|
|
|
|
|
```bash
|
|
|
|
|
# Start persistent test environment (for manual experimentation)
|
2025-08-01 17:04:10 +02:00
|
|
|
./start-test-env.sh
|
|
|
|
|
|
feat: add comprehensive README documentation and clean up configuration
## Documentation Enhancements
- Create comprehensive README with installation, configuration, and usage examples
- Add simple, advanced, and provider-specific configuration examples
- Document all features: incremental sync, wildcard patterns, keyword filtering, attachment support
- Include production deployment guidance and troubleshooting section
- Add architecture documentation with database structure and document format examples
## Configuration Cleanup
- Remove unnecessary `database` field from CouchDB configuration
- Add `m2c_` prefix to all CouchDB database names for better namespace isolation
- Update GenerateAccountDBName() to consistently prefix databases with `m2c_`
- Clean up all configuration examples to remove deprecated database field
## Test Environment Simplification
- Simplify test script structure to eliminate confusion and redundancy
- Remove redundant populate-test-messages.sh wrapper script
- Update run-tests.sh to be comprehensive automated test with cleanup
- Maintain clear separation: automated tests vs manual testing environment
- Update all test scripts to expect m2c-prefixed database names
## Configuration Examples Added
- config-simple.json: Basic single Gmail account setup
- config-advanced.json: Multi-account with complex filtering and different providers
- config-providers.json: Real-world configurations for Gmail, Outlook, Yahoo, iCloud
## Benefits
- Clear documentation for users from beginner to advanced
- Namespace isolation prevents database conflicts in shared CouchDB instances
- Simplified test workflow eliminates user confusion about which scripts to use
- Comprehensive examples cover common email provider configurations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 21:26:53 +02:00
|
|
|
# Run mail2couch manually with different configurations
|
2025-08-01 17:04:10 +02:00
|
|
|
cd ../go
|
|
|
|
|
./mail2couch -config ../test/config-test.json
|
feat: add comprehensive README documentation and clean up configuration
## Documentation Enhancements
- Create comprehensive README with installation, configuration, and usage examples
- Add simple, advanced, and provider-specific configuration examples
- Document all features: incremental sync, wildcard patterns, keyword filtering, attachment support
- Include production deployment guidance and troubleshooting section
- Add architecture documentation with database structure and document format examples
## Configuration Cleanup
- Remove unnecessary `database` field from CouchDB configuration
- Add `m2c_` prefix to all CouchDB database names for better namespace isolation
- Update GenerateAccountDBName() to consistently prefix databases with `m2c_`
- Clean up all configuration examples to remove deprecated database field
## Test Environment Simplification
- Simplify test script structure to eliminate confusion and redundancy
- Remove redundant populate-test-messages.sh wrapper script
- Update run-tests.sh to be comprehensive automated test with cleanup
- Maintain clear separation: automated tests vs manual testing environment
- Update all test scripts to expect m2c-prefixed database names
## Configuration Examples Added
- config-simple.json: Basic single Gmail account setup
- config-advanced.json: Multi-account with complex filtering and different providers
- config-providers.json: Real-world configurations for Gmail, Outlook, Yahoo, iCloud
## Benefits
- Clear documentation for users from beginner to advanced
- Namespace isolation prevents database conflicts in shared CouchDB instances
- Simplified test workflow eliminates user confusion about which scripts to use
- Comprehensive examples cover common email provider configurations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 21:26:53 +02:00
|
|
|
./mail2couch -config ../test/config-wildcard-examples.json
|
2025-08-01 17:04:10 +02:00
|
|
|
|
|
|
|
|
# Stop test environment when done
|
|
|
|
|
cd ../test
|
|
|
|
|
./stop-test-env.sh
|
|
|
|
|
```
|
|
|
|
|
|
feat: add comprehensive README documentation and clean up configuration
## Documentation Enhancements
- Create comprehensive README with installation, configuration, and usage examples
- Add simple, advanced, and provider-specific configuration examples
- Document all features: incremental sync, wildcard patterns, keyword filtering, attachment support
- Include production deployment guidance and troubleshooting section
- Add architecture documentation with database structure and document format examples
## Configuration Cleanup
- Remove unnecessary `database` field from CouchDB configuration
- Add `m2c_` prefix to all CouchDB database names for better namespace isolation
- Update GenerateAccountDBName() to consistently prefix databases with `m2c_`
- Clean up all configuration examples to remove deprecated database field
## Test Environment Simplification
- Simplify test script structure to eliminate confusion and redundancy
- Remove redundant populate-test-messages.sh wrapper script
- Update run-tests.sh to be comprehensive automated test with cleanup
- Maintain clear separation: automated tests vs manual testing environment
- Update all test scripts to expect m2c-prefixed database names
## Configuration Examples Added
- config-simple.json: Basic single Gmail account setup
- config-advanced.json: Multi-account with complex filtering and different providers
- config-providers.json: Real-world configurations for Gmail, Outlook, Yahoo, iCloud
## Benefits
- Clear documentation for users from beginner to advanced
- Namespace isolation prevents database conflicts in shared CouchDB instances
- Simplified test workflow eliminates user confusion about which scripts to use
- Comprehensive examples cover common email provider configurations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 21:26:53 +02:00
|
|
|
## Test Scripts Overview
|
|
|
|
|
|
|
|
|
|
### Automated Testing (Recommended)
|
|
|
|
|
- **`./run-tests.sh`**: Complete integration test with automatic cleanup
|
|
|
|
|
- Starts containers, populates data, runs mail2couch, verifies results
|
|
|
|
|
- Tests basic functionality, database creation, and incremental sync
|
|
|
|
|
- Cleans up automatically - perfect for CI/CD or quick validation
|
|
|
|
|
|
|
|
|
|
### Specialized Feature Testing
|
|
|
|
|
- **`./test-wildcard-patterns.sh`**: Comprehensive folder pattern testing
|
|
|
|
|
- Tests `*`, `Work*`, `*/Drafts`, and complex include/exclude patterns
|
|
|
|
|
- Self-contained with own setup/teardown
|
|
|
|
|
- **`./test-incremental-sync.sh`**: Incremental synchronization testing
|
|
|
|
|
- Tests sync metadata tracking and IMAP SEARCH with SINCE
|
|
|
|
|
- Multi-step validation: baseline sync → add messages → incremental sync
|
|
|
|
|
- Self-contained with own setup/teardown
|
|
|
|
|
|
|
|
|
|
### Manual Testing Environment
|
|
|
|
|
- **`./start-test-env.sh`**: Start persistent test containers
|
|
|
|
|
- Keeps environment running for manual experimentation
|
|
|
|
|
- Populates test data once
|
|
|
|
|
- Use with different configurations for development
|
|
|
|
|
- **`./stop-test-env.sh`**: Clean up manual test environment
|
|
|
|
|
- Only needed after using `start-test-env.sh`
|
|
|
|
|
|
2025-08-01 17:04:10 +02:00
|
|
|
## Test Accounts
|
|
|
|
|
|
|
|
|
|
The test environment includes these IMAP accounts:
|
|
|
|
|
|
feat: implement comprehensive wildcard folder selection and keyword filtering
## Wildcard Folder Selection
- Add support for wildcard patterns (`*`, `?`, `[abc]`) using filepath.Match
- Implement special case: `"*"` selects ALL available folders
- Support for complex include/exclude pattern combinations
- Maintain backwards compatibility with exact string matching
- Enable subfolder pattern matching (e.g., `Work/*`, `*/Drafts`)
## Keyword Filtering
- Add SubjectKeywords, SenderKeywords, RecipientKeywords to MessageFilter config
- Implement case-insensitive keyword matching across message fields
- Support multiple keywords per filter type with inclusive OR logic
- Add ShouldProcessMessage method for message-level filtering
## Enhanced Test Environment
- Create comprehensive wildcard pattern test scenarios
- Add 12 test folders covering various pattern types: Work/*, Important/*, Archive/*, exact matches
- Implement dedicated wildcard test script (test-wildcard-patterns.sh)
- Update test configurations to demonstrate real-world wildcard usage patterns
- Enhance test data generation with folder-specific messages for validation
## Documentation
- Create FOLDER_PATTERNS.md with comprehensive wildcard examples and use cases
- Update CLAUDE.md to reflect all implemented features and current status
- Enhance test README with detailed wildcard pattern explanations
- Provide configuration examples for common email organization scenarios
## Message Origin Tracking
- Verify all messages in CouchDB properly tagged with origin folder in `mailbox` field
- Maintain per-account database isolation for better organization
- Document ID format: `{folder}_{uid}` ensures uniqueness across folders
Key patterns supported:
- `["*"]` - All folders (with excludes)
- `["Work*", "Important*"]` - Prefix matching
- `["Work/*", "Archive/*"]` - Subfolder patterns
- `["INBOX", "Sent"]` - Exact matches
- Complex include/exclude combinations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 17:24:02 +02:00
|
|
|
| Username | Password | Mode | Folder Pattern | Purpose |
|
|
|
|
|
|----------|----------|------|---------------|---------|
|
|
|
|
|
| `testuser1` | `password123` | archive | `*` (exclude Drafts, Trash) | Wildcard all folders test |
|
|
|
|
|
| `syncuser` | `syncpass` | sync | `Work*`, `Important*`, `INBOX` | Work pattern test |
|
|
|
|
|
| `archiveuser` | `archivepass` | archive | `INBOX`, `Sent`, `Personal` | Specific folders test |
|
|
|
|
|
| `testuser2` | `password456` | archive | `Work/*`, `Archive/*` | Subfolder pattern test |
|
2025-08-01 17:04:10 +02:00
|
|
|
|
|
|
|
|
Each account contains:
|
|
|
|
|
- 10 messages in INBOX (every 3rd has an attachment)
|
feat: implement comprehensive wildcard folder selection and keyword filtering
## Wildcard Folder Selection
- Add support for wildcard patterns (`*`, `?`, `[abc]`) using filepath.Match
- Implement special case: `"*"` selects ALL available folders
- Support for complex include/exclude pattern combinations
- Maintain backwards compatibility with exact string matching
- Enable subfolder pattern matching (e.g., `Work/*`, `*/Drafts`)
## Keyword Filtering
- Add SubjectKeywords, SenderKeywords, RecipientKeywords to MessageFilter config
- Implement case-insensitive keyword matching across message fields
- Support multiple keywords per filter type with inclusive OR logic
- Add ShouldProcessMessage method for message-level filtering
## Enhanced Test Environment
- Create comprehensive wildcard pattern test scenarios
- Add 12 test folders covering various pattern types: Work/*, Important/*, Archive/*, exact matches
- Implement dedicated wildcard test script (test-wildcard-patterns.sh)
- Update test configurations to demonstrate real-world wildcard usage patterns
- Enhance test data generation with folder-specific messages for validation
## Documentation
- Create FOLDER_PATTERNS.md with comprehensive wildcard examples and use cases
- Update CLAUDE.md to reflect all implemented features and current status
- Enhance test README with detailed wildcard pattern explanations
- Provide configuration examples for common email organization scenarios
## Message Origin Tracking
- Verify all messages in CouchDB properly tagged with origin folder in `mailbox` field
- Maintain per-account database isolation for better organization
- Document ID format: `{folder}_{uid}` ensures uniqueness across folders
Key patterns supported:
- `["*"]` - All folders (with excludes)
- `["Work*", "Important*"]` - Prefix matching
- `["Work/*", "Archive/*"]` - Subfolder patterns
- `["INBOX", "Sent"]` - Exact matches
- Complex include/exclude combinations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 17:24:02 +02:00
|
|
|
- 3 messages in each additional folder
|
|
|
|
|
- Test folders: `Sent`, `Work/Projects`, `Work/Archive`, `Work/Temp`, `Personal`, `Important/Urgent`, `Important/Meetings`, `Archive/2024`, `Archive/Projects`, `Archive/Drafts`, `Drafts`, `Trash`
|
|
|
|
|
- Various message types for comprehensive wildcard testing
|
2025-08-01 17:04:10 +02:00
|
|
|
|
|
|
|
|
## Services
|
|
|
|
|
|
|
|
|
|
### CouchDB
|
|
|
|
|
- **URL**: http://localhost:5984
|
|
|
|
|
- **Admin**: `admin` / `password`
|
|
|
|
|
- **Web UI**: http://localhost:5984/_utils
|
|
|
|
|
|
|
|
|
|
### GreenMail Server
|
|
|
|
|
- **Host**: localhost
|
|
|
|
|
- **IMAP Port**: 3143 (plain)
|
|
|
|
|
- **IMAPS Port**: 3993 (SSL)
|
|
|
|
|
- **SMTP Port**: 3025
|
|
|
|
|
- **Server**: GreenMail (Java-based test server)
|
|
|
|
|
|
2025-08-02 14:57:51 +02:00
|
|
|
### Accessing Test Data
|
|
|
|
|
After running mail2couch, you can access the stored emails via CouchDB's REST API:
|
|
|
|
|
|
|
|
|
|
**📋 Database Access:**
|
|
|
|
|
- All databases: http://localhost:5984/_all_dbs
|
|
|
|
|
- Specific database: http://localhost:5984/m2c_specific_folders_only
|
|
|
|
|
- All documents: http://localhost:5984/m2c_specific_folders_only/_all_docs
|
|
|
|
|
- Individual message: http://localhost:5984/m2c_specific_folders_only/INBOX_12
|
|
|
|
|
|
|
|
|
|
**🔍 Raw Data Examples:**
|
|
|
|
|
- Database info: http://localhost:5984/m2c_specific_folders_only
|
|
|
|
|
- Document content: http://localhost:5984/m2c_specific_folders_only/INBOX_1
|
|
|
|
|
- Email attachments: http://localhost:5984/m2c_specific_folders_only/INBOX_1/{attachment_name}
|
|
|
|
|
|
2025-08-01 17:04:10 +02:00
|
|
|
## Database Structure
|
|
|
|
|
|
feat: add comprehensive README documentation and clean up configuration
## Documentation Enhancements
- Create comprehensive README with installation, configuration, and usage examples
- Add simple, advanced, and provider-specific configuration examples
- Document all features: incremental sync, wildcard patterns, keyword filtering, attachment support
- Include production deployment guidance and troubleshooting section
- Add architecture documentation with database structure and document format examples
## Configuration Cleanup
- Remove unnecessary `database` field from CouchDB configuration
- Add `m2c_` prefix to all CouchDB database names for better namespace isolation
- Update GenerateAccountDBName() to consistently prefix databases with `m2c_`
- Clean up all configuration examples to remove deprecated database field
## Test Environment Simplification
- Simplify test script structure to eliminate confusion and redundancy
- Remove redundant populate-test-messages.sh wrapper script
- Update run-tests.sh to be comprehensive automated test with cleanup
- Maintain clear separation: automated tests vs manual testing environment
- Update all test scripts to expect m2c-prefixed database names
## Configuration Examples Added
- config-simple.json: Basic single Gmail account setup
- config-advanced.json: Multi-account with complex filtering and different providers
- config-providers.json: Real-world configurations for Gmail, Outlook, Yahoo, iCloud
## Benefits
- Clear documentation for users from beginner to advanced
- Namespace isolation prevents database conflicts in shared CouchDB instances
- Simplified test workflow eliminates user confusion about which scripts to use
- Comprehensive examples cover common email provider configurations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 21:26:53 +02:00
|
|
|
mail2couch will create separate databases for each mail source (with `m2c_` prefix):
|
|
|
|
|
- `m2c_wildcard_all_folders_test` - Wildcard All Folders Test (archive mode)
|
|
|
|
|
- `m2c_work_pattern_test` - Work Pattern Test (sync mode)
|
|
|
|
|
- `m2c_specific_folders_only` - Specific Folders Only (archive mode)
|
|
|
|
|
- `m2c_subfolder_pattern_test` - Subfolder Pattern Test (archive mode)
|
feat: implement comprehensive wildcard folder selection and keyword filtering
## Wildcard Folder Selection
- Add support for wildcard patterns (`*`, `?`, `[abc]`) using filepath.Match
- Implement special case: `"*"` selects ALL available folders
- Support for complex include/exclude pattern combinations
- Maintain backwards compatibility with exact string matching
- Enable subfolder pattern matching (e.g., `Work/*`, `*/Drafts`)
## Keyword Filtering
- Add SubjectKeywords, SenderKeywords, RecipientKeywords to MessageFilter config
- Implement case-insensitive keyword matching across message fields
- Support multiple keywords per filter type with inclusive OR logic
- Add ShouldProcessMessage method for message-level filtering
## Enhanced Test Environment
- Create comprehensive wildcard pattern test scenarios
- Add 12 test folders covering various pattern types: Work/*, Important/*, Archive/*, exact matches
- Implement dedicated wildcard test script (test-wildcard-patterns.sh)
- Update test configurations to demonstrate real-world wildcard usage patterns
- Enhance test data generation with folder-specific messages for validation
## Documentation
- Create FOLDER_PATTERNS.md with comprehensive wildcard examples and use cases
- Update CLAUDE.md to reflect all implemented features and current status
- Enhance test README with detailed wildcard pattern explanations
- Provide configuration examples for common email organization scenarios
## Message Origin Tracking
- Verify all messages in CouchDB properly tagged with origin folder in `mailbox` field
- Maintain per-account database isolation for better organization
- Document ID format: `{folder}_{uid}` ensures uniqueness across folders
Key patterns supported:
- `["*"]` - All folders (with excludes)
- `["Work*", "Important*"]` - Prefix matching
- `["Work/*", "Archive/*"]` - Subfolder patterns
- `["INBOX", "Sent"]` - Exact matches
- Complex include/exclude combinations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 17:24:02 +02:00
|
|
|
|
|
|
|
|
Each database contains documents with:
|
|
|
|
|
- `mailbox` field indicating the origin folder
|
|
|
|
|
- Native CouchDB attachments for email attachments
|
|
|
|
|
- Full message headers and body content
|
2025-08-02 14:57:51 +02:00
|
|
|
- JSON documents accessible via CouchDB REST API
|
2025-08-01 17:04:10 +02:00
|
|
|
|
|
|
|
|
## Testing Sync vs Archive Modes
|
|
|
|
|
|
|
|
|
|
### Sync Mode (`syncuser`)
|
|
|
|
|
- Database exactly matches mail account
|
|
|
|
|
- If messages are deleted from IMAP, they're removed from CouchDB
|
|
|
|
|
- 1-to-1 relationship
|
|
|
|
|
|
|
|
|
|
### Archive Mode (`archiveuser`, `testuser1`)
|
|
|
|
|
- Database preserves all messages ever seen
|
|
|
|
|
- Messages deleted from IMAP remain in CouchDB
|
|
|
|
|
- Archive/backup behavior
|
|
|
|
|
|
feat: implement comprehensive wildcard folder selection and keyword filtering
## Wildcard Folder Selection
- Add support for wildcard patterns (`*`, `?`, `[abc]`) using filepath.Match
- Implement special case: `"*"` selects ALL available folders
- Support for complex include/exclude pattern combinations
- Maintain backwards compatibility with exact string matching
- Enable subfolder pattern matching (e.g., `Work/*`, `*/Drafts`)
## Keyword Filtering
- Add SubjectKeywords, SenderKeywords, RecipientKeywords to MessageFilter config
- Implement case-insensitive keyword matching across message fields
- Support multiple keywords per filter type with inclusive OR logic
- Add ShouldProcessMessage method for message-level filtering
## Enhanced Test Environment
- Create comprehensive wildcard pattern test scenarios
- Add 12 test folders covering various pattern types: Work/*, Important/*, Archive/*, exact matches
- Implement dedicated wildcard test script (test-wildcard-patterns.sh)
- Update test configurations to demonstrate real-world wildcard usage patterns
- Enhance test data generation with folder-specific messages for validation
## Documentation
- Create FOLDER_PATTERNS.md with comprehensive wildcard examples and use cases
- Update CLAUDE.md to reflect all implemented features and current status
- Enhance test README with detailed wildcard pattern explanations
- Provide configuration examples for common email organization scenarios
## Message Origin Tracking
- Verify all messages in CouchDB properly tagged with origin folder in `mailbox` field
- Maintain per-account database isolation for better organization
- Document ID format: `{folder}_{uid}` ensures uniqueness across folders
Key patterns supported:
- `["*"]` - All folders (with excludes)
- `["Work*", "Important*"]` - Prefix matching
- `["Work/*", "Archive/*"]` - Subfolder patterns
- `["INBOX", "Sent"]` - Exact matches
- Complex include/exclude combinations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 17:24:02 +02:00
|
|
|
## Wildcard Pattern Examples
|
|
|
|
|
|
|
|
|
|
The test environment demonstrates these wildcard patterns:
|
|
|
|
|
|
|
|
|
|
### All Folders Pattern (`*`)
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"folderFilter": {
|
|
|
|
|
"include": ["*"],
|
|
|
|
|
"exclude": ["Drafts", "Trash"]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
Processes all folders except Drafts and Trash.
|
|
|
|
|
|
|
|
|
|
### Work Pattern (`Work*`)
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"folderFilter": {
|
|
|
|
|
"include": ["Work*", "Important*", "INBOX"],
|
|
|
|
|
"exclude": ["*Temp*"]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
Includes Work/Projects, Work/Archive, Important/Urgent, Important/Meetings, and INBOX. Excludes Work/Temp.
|
|
|
|
|
|
|
|
|
|
### Specific Folders
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"folderFilter": {
|
|
|
|
|
"include": ["INBOX", "Sent", "Personal"],
|
|
|
|
|
"exclude": []
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
Only processes the exact named folders.
|
|
|
|
|
|
|
|
|
|
### Subfolder Pattern (`Work/*`)
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"folderFilter": {
|
|
|
|
|
"include": ["Work/*", "Archive/*"],
|
|
|
|
|
"exclude": ["*/Drafts"]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
Includes all subfolders under Work and Archive, but excludes any Drafts subfolder.
|
|
|
|
|
|
2025-08-01 17:04:10 +02:00
|
|
|
## File Structure
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
test/
|
feat: add comprehensive README documentation and clean up configuration
## Documentation Enhancements
- Create comprehensive README with installation, configuration, and usage examples
- Add simple, advanced, and provider-specific configuration examples
- Document all features: incremental sync, wildcard patterns, keyword filtering, attachment support
- Include production deployment guidance and troubleshooting section
- Add architecture documentation with database structure and document format examples
## Configuration Cleanup
- Remove unnecessary `database` field from CouchDB configuration
- Add `m2c_` prefix to all CouchDB database names for better namespace isolation
- Update GenerateAccountDBName() to consistently prefix databases with `m2c_`
- Clean up all configuration examples to remove deprecated database field
## Test Environment Simplification
- Simplify test script structure to eliminate confusion and redundancy
- Remove redundant populate-test-messages.sh wrapper script
- Update run-tests.sh to be comprehensive automated test with cleanup
- Maintain clear separation: automated tests vs manual testing environment
- Update all test scripts to expect m2c-prefixed database names
## Configuration Examples Added
- config-simple.json: Basic single Gmail account setup
- config-advanced.json: Multi-account with complex filtering and different providers
- config-providers.json: Real-world configurations for Gmail, Outlook, Yahoo, iCloud
## Benefits
- Clear documentation for users from beginner to advanced
- Namespace isolation prevents database conflicts in shared CouchDB instances
- Simplified test workflow eliminates user confusion about which scripts to use
- Comprehensive examples cover common email provider configurations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 21:26:53 +02:00
|
|
|
├── podman-compose.yml # Container orchestration (GreenMail + CouchDB)
|
|
|
|
|
├── config-test.json # Main test configuration with wildcard examples
|
feat: implement comprehensive wildcard folder selection and keyword filtering
## Wildcard Folder Selection
- Add support for wildcard patterns (`*`, `?`, `[abc]`) using filepath.Match
- Implement special case: `"*"` selects ALL available folders
- Support for complex include/exclude pattern combinations
- Maintain backwards compatibility with exact string matching
- Enable subfolder pattern matching (e.g., `Work/*`, `*/Drafts`)
## Keyword Filtering
- Add SubjectKeywords, SenderKeywords, RecipientKeywords to MessageFilter config
- Implement case-insensitive keyword matching across message fields
- Support multiple keywords per filter type with inclusive OR logic
- Add ShouldProcessMessage method for message-level filtering
## Enhanced Test Environment
- Create comprehensive wildcard pattern test scenarios
- Add 12 test folders covering various pattern types: Work/*, Important/*, Archive/*, exact matches
- Implement dedicated wildcard test script (test-wildcard-patterns.sh)
- Update test configurations to demonstrate real-world wildcard usage patterns
- Enhance test data generation with folder-specific messages for validation
## Documentation
- Create FOLDER_PATTERNS.md with comprehensive wildcard examples and use cases
- Update CLAUDE.md to reflect all implemented features and current status
- Enhance test README with detailed wildcard pattern explanations
- Provide configuration examples for common email organization scenarios
## Message Origin Tracking
- Verify all messages in CouchDB properly tagged with origin folder in `mailbox` field
- Maintain per-account database isolation for better organization
- Document ID format: `{folder}_{uid}` ensures uniqueness across folders
Key patterns supported:
- `["*"]` - All folders (with excludes)
- `["Work*", "Important*"]` - Prefix matching
- `["Work/*", "Archive/*"]` - Subfolder patterns
- `["INBOX", "Sent"]` - Exact matches
- Complex include/exclude combinations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 17:24:02 +02:00
|
|
|
├── config-wildcard-examples.json # Advanced wildcard patterns
|
feat: add comprehensive README documentation and clean up configuration
## Documentation Enhancements
- Create comprehensive README with installation, configuration, and usage examples
- Add simple, advanced, and provider-specific configuration examples
- Document all features: incremental sync, wildcard patterns, keyword filtering, attachment support
- Include production deployment guidance and troubleshooting section
- Add architecture documentation with database structure and document format examples
## Configuration Cleanup
- Remove unnecessary `database` field from CouchDB configuration
- Add `m2c_` prefix to all CouchDB database names for better namespace isolation
- Update GenerateAccountDBName() to consistently prefix databases with `m2c_`
- Clean up all configuration examples to remove deprecated database field
## Test Environment Simplification
- Simplify test script structure to eliminate confusion and redundancy
- Remove redundant populate-test-messages.sh wrapper script
- Update run-tests.sh to be comprehensive automated test with cleanup
- Maintain clear separation: automated tests vs manual testing environment
- Update all test scripts to expect m2c-prefixed database names
## Configuration Examples Added
- config-simple.json: Basic single Gmail account setup
- config-advanced.json: Multi-account with complex filtering and different providers
- config-providers.json: Real-world configurations for Gmail, Outlook, Yahoo, iCloud
## Benefits
- Clear documentation for users from beginner to advanced
- Namespace isolation prevents database conflicts in shared CouchDB instances
- Simplified test workflow eliminates user confusion about which scripts to use
- Comprehensive examples cover common email provider configurations
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 21:26:53 +02:00
|
|
|
├── run-tests.sh # Automated integration test (recommended)
|
|
|
|
|
├── test-wildcard-patterns.sh # Specialized wildcard pattern testing
|
|
|
|
|
├── test-incremental-sync.sh # Specialized incremental sync testing
|
|
|
|
|
├── start-test-env.sh # Start persistent test environment
|
|
|
|
|
├── stop-test-env.sh # Stop test environment
|
|
|
|
|
├── populate-greenmail.py # Create test messages across multiple folders
|
|
|
|
|
├── dovecot/ # Dovecot configuration (legacy, unused)
|
|
|
|
|
└── README.md # This file
|
2025-08-01 17:04:10 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Prerequisites
|
|
|
|
|
|
|
|
|
|
- Podman and podman-compose
|
|
|
|
|
- OpenSSL (for certificate generation)
|
|
|
|
|
- curl and nc (for connectivity checks)
|
|
|
|
|
- Go (for building mail2couch)
|
|
|
|
|
|
|
|
|
|
## Troubleshooting
|
|
|
|
|
|
|
|
|
|
### Containers won't start
|
|
|
|
|
```bash
|
|
|
|
|
# Check podman status
|
|
|
|
|
podman ps -a
|
|
|
|
|
|
|
|
|
|
# View logs
|
|
|
|
|
podman logs mail2couch_test_couchdb
|
|
|
|
|
podman logs mail2couch_test_imap
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### CouchDB connection issues
|
|
|
|
|
- Verify CouchDB is running: `curl http://localhost:5984`
|
|
|
|
|
- Check admin credentials: `admin/password`
|
|
|
|
|
|
|
|
|
|
### IMAP connection issues
|
|
|
|
|
- Test IMAP connection: `nc -z localhost 143`
|
|
|
|
|
- Check Dovecot logs: `podman logs mail2couch_test_imap`
|
|
|
|
|
|
|
|
|
|
### Permission issues
|
|
|
|
|
- Ensure scripts are executable: `chmod +x *.sh`
|
|
|
|
|
- Check file permissions in dovecot directory
|
|
|
|
|
|
|
|
|
|
## Advanced Usage
|
|
|
|
|
|
|
|
|
|
### Add custom test messages
|
|
|
|
|
Edit `populate-test-messages.sh` to create additional test scenarios.
|
|
|
|
|
|
|
|
|
|
### Modify IMAP configuration
|
|
|
|
|
Edit `dovecot/dovecot.conf` and restart containers.
|
|
|
|
|
|
|
|
|
|
### Test with SSL
|
|
|
|
|
Update `config-test.json` to use port 993 and enable SSL.
|
|
|
|
|
|
|
|
|
|
### Custom test scenarios
|
|
|
|
|
Create additional configuration files for specific test cases.
|