Skip to content

Preserve message bodies inside nested multipart MIME structures #14

Open

Description

@LunaStev

Problem

decodeMIMEBody recursively decodes a multipart child but retains the result only if the child's own Content-Type starts with text/. A multipart/mixed envelope containing multipart/alternative plus an attachment therefore loses its valid body.

Evidence / regression scenario

An isolated Go test using a mixed message with a nested alternative part and an attachment returned body="" with err=nil instead of its plain-text body.

Code references

Audit baseline: 50eb207.

Completion criteria

  • Return the preferred display body from nested multipart/alternative and multipart/related structures inside mixed messages.
  • Prefer a non-attachment plain-text body and use safe existing fallback semantics when only HTML is available; do not select a text attachment as the message body.
  • Add raw MIME fixtures covering nested mixed/alternative, related, plain-only, empty parts and malformed nested parts.
  • Keep transfer-encoding decoding and original RFC message storage unchanged.

Scope and dependencies

Difficulty: medium.

Fix body selection, not attachment upload/download or a new HTML mail renderer.

Backlog index: #12. Keep the change limited to this issue and include focused verification in the pull request.

Activity

  1. added
    bug
    help wanted
    mail
    priority high
    needs testing
    on Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wantedmailneeds testingpriority high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions