Fix: Quote mailbox names and add IMAP flag detection for Sent folder#93
Merged
Wh1isper merged 2 commits intoai-zerolab:mainfrom Jan 7, 2026
Merged
Conversation
Fixes emails not being saved to Sent folder for providers like IONOS that use folder names with spaces (e.g., "Gesendete Objekte"). Changes: - Use _quote_mailbox() in IMAP APPEND command (RFC 3501 compliance) - Add _find_sent_folder_by_flag() to detect Sent folder via IMAP \Sent flag - Add error handling around append_to_sent() Tested with: - IONOS: Now works correctly - Gmail: Backward compatible, still works
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
- Test _find_sent_folder_by_flag() with various folder names (IONOS, Gmail, etc.) - Test integration with append_to_sent() - Test error handling when append_to_sent fails - All 9 new tests passing, total 27/27 tests in test_save_to_sent.py
Contributor
Author
|
Added comprehensive tests for the new functionality: Test Coverage:
Results:
This should address the code coverage concerns from Codecov. |
rrroyal
pushed a commit
to rrroyal/mcp-email-server-auth
that referenced
this pull request
Jan 9, 2026
…i-zerolab#93) * Fix: Quote mailbox names and add IMAP flag detection for Sent folder Fixes emails not being saved to Sent folder for providers like IONOS that use folder names with spaces (e.g., "Gesendete Objekte"). Changes: - Use _quote_mailbox() in IMAP APPEND command (RFC 3501 compliance) - Add _find_sent_folder_by_flag() to detect Sent folder via IMAP \Sent flag - Add error handling around append_to_sent() Tested with: - IONOS: Now works correctly - Gmail: Backward compatible, still works * Add comprehensive tests for IMAP flag detection and error handling - Test _find_sent_folder_by_flag() with various folder names (IONOS, Gmail, etc.) - Test integration with append_to_sent() - Test error handling when append_to_sent fails - All 9 new tests passing, total 27/27 tests in test_save_to_sent.py --------- Co-authored-by: KonstiDoll <konstantin.doll@urban-codesign.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #92
Changes
Quote mailbox names in IMAP APPEND (critical fix)
_quote_mailbox()helper in APPEND commandAuto-detect Sent folder via IMAP \Sent flag (enhancement)
_find_sent_folder_by_flag()methodImproved error handling
append_to_sent()in try-exceptTesting
Technical Details
The issue affected providers like IONOS that use folder names with spaces. The IMAP APPEND command requires quoted mailbox names per RFC 3501, but this wasn't enforced.
Example: IONOS uses
"Gesendete Objekte"which failed without quoting.The IMAP flag-based detection makes the server more robust for international users and various providers.