Pulga
Pulga

Reputation: 51

IMAP - ENVELOPE vs. RFC822 headers, Fetching whole message vs body parts, etc

I'm writing an IMAP client and I have a question.

To get Sender, From, To, CC, etc -

I can FETCH RFC822.HEADER , which will give me a long string w/sometimes not relevant information, or I can FETCH ALL / FETCH ENVELOPE, which will give me a nice formatted version of the main info I need, which is Date, Subject, Sender, etc.

To get email message / attachments -

I can FETCH BODY.PEEK[], which will give me a MIME string with every part of the message regardless of whether I want it (nor does it give the MIME boundaries in an easy to read parse format like BODYSTRUCTURE does), or I can FETCH BODYSTRUCTURE / FETCH (BODY ENVELOPE), then parse out the individual parts I want/need, without having to download everything.

My question is whether using the rfc822 headers, or downloading an entire MIME string, is every really necessary in an email client? It seems like BODYSTRUCTURE & ENVELOPE have made this much easier, so is there any reason I would ever need to manually parse the RFC822 headers / MIME message in my email client? I should be able to do everything a client would ever need with ENVELOPE & BODYSTRUCTURE, correct?

Thank you.

Upvotes: 5

Views: 4156

Answers (1)

arnt
arnt

Reputation: 9685

You can make do with BODYSTRUCTURE, ENVELOPE (and BODY.PEEK[1] etc when you need to fetch bodyparts).

You may find that at some point, before or after 1.0, you may choose to e.g. retrieve BODY.PEEK[HEADER.FIELDS (List-Id)] or other things. But overall you're right, BODYSTRUCTURE and ENVELOPE are enough.

Upvotes: 1

Related Questions