feat: implement Go-based mail2couch with working IMAP and CouchDB integration

- Add configuration system with automatic file discovery (current dir, config subdir, user home, XDG config)
- Implement IMAP client with TLS connection, authentication, and mailbox listing
- Add CouchDB integration with database creation and document storage
- Support folder filtering (include/exclude) and date filtering (since parameter)
- Include duplicate detection to prevent re-storing existing messages
- Add comprehensive error handling and logging throughout
- Structure code in clean packages: config, mail, couch
- Application currently uses placeholder messages to test the storage pipeline
- Ready for real IMAP message parsing implementation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2025-07-29 17:18:20 +02:00
commit 1e4a67d4cb
9 changed files with 746 additions and 0 deletions

42
config.json Normal file
View file

@ -0,0 +1,42 @@
{
"couchDb": {
"url": "http://localhost:5984",
"user": "admin",
"password": "password",
"database": "mail_backup"
},
"mailSources": [
{
"name": "Personal Gmail",
"enabled": true,
"protocol": "imap",
"host": "imap.gmail.com",
"port": 993,
"user": "your-email@gmail.com",
"password": "your-app-password",
"sync": true,
"folderFilter": {
"include": ["INBOX", "Sent"],
"exclude": ["Spam", "Trash"]
},
"messageFilter": {
"since": "2024-01-01"
}
},
{
"name": "Work Account",
"enabled": true,
"protocol": "imap",
"host": "imap.work.com",
"port": 993,
"user": "user@work.com",
"password": "password",
"sync": true,
"folderFilter": {
"include": [],
"exclude": []
},
"messageFilter": {}
}
]
}