Skip to content

feat: Add HTML body fallback when text/plain is not available#114

Merged
Wh1isper merged 3 commits intoai-zerolab:mainfrom
peteWT:feat/html-body-fallback
Feb 14, 2026
Merged

feat: Add HTML body fallback when text/plain is not available#114
Wh1isper merged 3 commits intoai-zerolab:mainfrom
peteWT:feat/html-body-fallback

Conversation

@peteWT
Copy link
Contributor

@peteWT peteWT commented Jan 29, 2026

Summary

  • Adds HTML body fallback when text/plain is not available in emails
  • Many email clients (Outlook, Gmail, etc.) send HTML-only emails without a text/plain alternative, causing get_emails_content to return empty body fields
  • Strips HTML tags to convert to readable text

Changes

  • Collects text/html content as a fallback when parsing multipart emails
  • Adds _strip_html() helper function to convert HTML to readable text
  • Handles single-part HTML emails the same way

Test plan

  • Tested locally with emails from Gmail and Outlook that previously returned empty bodies
  • Verified plain text emails still work correctly (text/plain is preferred)
  • Unit tests (would appreciate guidance on test structure)

Fixes #113


🤖 Generated with Claude Code

Peter Tittmann and others added 2 commits January 29, 2026 08:49
Many email clients (Outlook, Gmail, etc.) send HTML-only emails without
a text/plain alternative. This causes get_emails_content to return empty
body fields.

This change:
- Collects text/html content as a fallback when parsing multipart emails
- Strips HTML tags to convert to readable text if no text/plain is found
- Handles single-part HTML emails the same way

Fixes ai-zerolab#113

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

❌ Patch coverage is 19.23077% with 21 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
mcp_email_server/emails/classic.py 19.2% 20 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@Wh1isper Wh1isper merged commit c442e33 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.

feat: Add HTML body fallback when text/plain is not available

2 participants