Thanks to visit codestin.com
Credit goes to github.com

Skip to content

standard library email.parser fails to recognize multipart message #135854

Open
@mok0

Description

@mok0

Bug report

Bug description:

If an email message with attachments contain a boundary with the characters "<--- ... --->" the email.parser module fails to recognize the message as being multipart.

I have attached to this bug report an example mailbox file, and when the following snippet is run on it you will see that is_multipart() returns False, although the message is clearly a multipart message.

I found this boundary string used in a real life email I received.

from email.parser import Parser

# Create parser instance
P = Parser()

with open("message-error.mbox") as f:
    msg = P.parse(f)

print(msg.is_multipart())

message-error.txt

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtopic-emailtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions