read_email, reply_to_email and download_attachment fetched the full message with the legacy bare RFC822 item (UID FETCH <uid> (RFC822)). iCloud's IMAP server silently ignores it — the fetch returns status OK but only (UID <uid>) with no body tuple, so the parse reports 'Email not found with UID' even though the message exists and list_emails (which uses RFC822.HEADER) shows it. Gmail honours (RFC822), which is why it only reproduced on iCloud. Switch the three full-message fetches to (BODY.PEEK[]), which iCloud and Gmail both honour and which doesn't set \Seen. Response shape is unchanged (raw bytes still at msg_data[0][1]), so parsing is unaffected; the RFC822.HEADER (listing) and (UID) probe fetches are left as-is. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
65 KiB
65 KiB