Problem
IMAP SEARCH on Gmail servers cannot handle CJK (Chinese/Japanese/Korean) characters. This is a known limitation of Gmail's IMAP implementation — search queries containing CJK text return empty results. This affects a significant number of users in East Asia.
Proposed Solution
Add a Gmail REST API backend that uses the Gmail API directly instead of going through IMAP. The Gmail API's q parameter natively supports CJK full-text search.
This backend would implement all existing feature traits (folders, envelopes, messages, flags) by mapping them to Gmail API endpoints:
- Gmail labels → folders
users.messages.list with q param → ListEnvelopes (CJK search works natively)
users.messages.get(format=RAW) → GetMessages (returns standard RFC 2822)
users.messages.send → SendMessage
users.messages.modify → flag/copy/move operations
- OAuth2 authentication (reusing existing OAuth2 infrastructure)
Implementation
I have a working implementation across all three repos (core, tui, himalaya):
All changes compile cleanly with cargo check --features gmail. The implementation follows the same patterns as the existing IMAP/Maildir/Notmuch backends.
I'd be happy to open PRs if you're interested in merging this upstream. Would appreciate feedback on the approach before doing so.
Problem
IMAP SEARCH on Gmail servers cannot handle CJK (Chinese/Japanese/Korean) characters. This is a known limitation of Gmail's IMAP implementation — search queries containing CJK text return empty results. This affects a significant number of users in East Asia.
Proposed Solution
Add a Gmail REST API backend that uses the Gmail API directly instead of going through IMAP. The Gmail API's
qparameter natively supports CJK full-text search.This backend would implement all existing feature traits (folders, envelopes, messages, flags) by mapping them to Gmail API endpoints:
users.messages.listwithqparam →ListEnvelopes(CJK search works natively)users.messages.get(format=RAW)→GetMessages(returns standard RFC 2822)users.messages.send→SendMessageusers.messages.modify→ flag/copy/move operationsImplementation
I have a working implementation across all three repos (core, tui, himalaya):
All changes compile cleanly with
cargo check --features gmail. The implementation follows the same patterns as the existing IMAP/Maildir/Notmuch backends.I'd be happy to open PRs if you're interested in merging this upstream. Would appreciate feedback on the approach before doing so.