Skip to content

fix: handle Proton Bridge IMAP response format in _batch_fetch_headers#112

Merged
Wh1isper merged 1 commit intoai-zerolab:mainfrom
simonluijk:fix/proton-bridge-header-uid-parsing
Feb 14, 2026
Merged

fix: handle Proton Bridge IMAP response format in _batch_fetch_headers#112
Wh1isper merged 1 commit intoai-zerolab:mainfrom
simonluijk:fix/proton-bridge-header-uid-parsing

Conversation

@simonluijk
Copy link
Contributor

Summary

  • Fixes Proton Bridge compatibility issue where list_emails_metadata returns empty emails list despite showing correct total count

Problem

When using Proton Bridge, the IMAP FETCH response for BODY.PEEK[HEADER] returns the UID in a separate item after the header data, rather than in the same line:

Standard format:

  • [i] = b'N FETCH (BODY[HEADER] {size} UID xxx)'
  • [i+1] = bytearray(headers)

Proton Bridge format:

  • [i] = b'N FETCH (BODY[HEADER] {size}'
  • [i+1] = bytearray(headers)
  • [i+2] = b' UID xxx)'

Solution

Added a fallback in _batch_fetch_headers to check for UID in data[i+2] when not found in data[i].

Testing

Tested with Proton Mail Bridge v3.x on macOS. The fix is backwards-compatible with standard IMAP servers.

Related to #87

Proton Bridge returns UID in a separate item after header data:
- [i] = b'N FETCH (BODY[HEADER] {size}'
- [i+1] = bytearray(headers)
- [i+2] = b' UID xxx)'

This adds a fallback to check for UID in data[i+2] when not found in data[i].

Related to ai-zerolab#87 (Proton Mail Bridge compatibility)
@codecov
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
mcp_email_server/emails/classic.py 0.0% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Wh1isper Wh1isper merged commit a3c8424 into ai-zerolab:main Feb 14, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants