Enough-Software / enough_mail

IMAP, POP3 and SMTP clients for Dart developers. Contains both low level as well as a high level API.
Mozilla Public License 2.0
104 stars 56 forks source link

IMAP: Support non-numeric nested body section specifiers #142

Open robert-virkus opened 3 years ago

robert-virkus commented 3 years ago

A body section specifier can contain various types such as , HEADER, MIME, etc. While most part specifiers are handled separatedly, only numeric section specifiers such as BODY[2.1] are currently supported. Complex ones such as BODY[2.1.HEADER] are currently not supported.

The RFC lists the following examples:

HEADER     ([RFC-2822] header of the message)
TEXT       ([RFC-2822] text body of the message) MULTIPART/MIXED
1          TEXT/PLAIN
2          APPLICATION/OCTET-STREAM
3          MESSAGE/RFC822
3.HEADER   ([RFC-2822] header of the message)
3.TEXT     ([RFC-2822] text body of the message) MULTIPART/MIXED
3.1        TEXT/PLAIN
3.2        APPLICATION/OCTET-STREAM
4          MULTIPART/MIXED
4.1        IMAGE/GIF
4.1.MIME   ([MIME-IMB] header for the IMAGE/GIF)
4.2        MESSAGE/RFC822
4.2.HEADER ([RFC-2822] header of the message)
4.2.TEXT   ([RFC-2822] text body of the message) MULTIPART/MIXED
4.2.1      TEXT/PLAIN
4.2.2      MULTIPART/ALTERNATIVE
4.2.2.1    TEXT/PLAIN
4.2.2.2    TEXT/RICHTEXT

The FetchParser should support nested body specifiers such as 4.2.HEADER.

azulli commented 3 years ago

Hi, I've already worked on this and I may do a pull request with the relevant changes, if it may be helpful.

robert-virkus commented 3 years ago

Looking forward to that!