Skip to content

Parts under message/rfc822 don't seem to be parsed. #265

Description

@ben221199

For my IMAP project, I have written a IMAP server in Java, which uses an API written in PHP as backend. IMAP has some fetch attributes that can be used to get a part of a message, like BODY[], BODY[HEADER, BODY[1] and BODY[2.TEXT].

My Java IMAP server doesn't do anything with this. It just parses the IMAP protocol and sends a request that PHP can understand to my backend. There, I use this library to parse the parts of the message, based on the requested fetch attributes, and only return those requested attributes back to the IMAP server.

However, I have noted that this library only parses parts of multipart/* messages. When a message/rfc822 is present, it doesn't to this. This is fine for default behaviour, but because message/rfc822 is a special type, I would like an option to enable part parsing for this MIME type too. Now, I have to do tricks with detecting a message, getting its content, and reparsing the part on demand.

Also, next to isMultiPart(), I think a isRFC822Message() function is useful:

    public function isRFC822Message() : bool
    {
        // casting to bool, preg_match returns 1 for true
        return (bool) (\preg_match(
            '~message/rfc822~i',
            $this->getContentType()
        ));
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions