|
|
|
|
||||||
| comp.mail.imap Discussion of IMAP-based mail systems. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I've been working on an email client based on IMAP but I have yet to
see a logical patern in the BODYSTRUCTURE call in IMAP. If someone could suggest a good way to parse this from a simple to complex email message it would be greatly appreciated. I have tried both BODY and BODYSTRUCTURE with no luck on parsing it out and building a segment table (ie: 1.1.1, 1.1.2, 2.1.1.2, ect) Carl |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
redragon@red-dragon.com wrote:
> I've been working on an email client based on IMAP but I have yet to > see a logical patern in the BODYSTRUCTURE call in IMAP. Oh god, not another "IMAP client author" who doesn't immediately refer to the RFC, as found at http://www.ietf.org/rfc/rfc3501.txt If you actually _have_ read the RFC and have specific questions about what it says, go ahead and ask them here or on the imap-protocol mailing list. That said, first, there is no such thing as a 'call' in IMAP. BODYSTRUCTURE data is returned as an item in untagged FETCH responses. Using proper terminology will ease communication with other IMAP developers. Next, if you want to understand BODYSTRUCTURE, you need to read RFC 3501 carefully. And then read it again. And then stare at the responses generated by known correct servers, followed by staring at the ceiling to ponder. The critically relevant sections of RFC 3501 are section 7.4.2 ("FETCH response") and section 9 ("Formal Syntax"). The former explains the fields and the nesting of the structures, while the latter explains the niggly details of where parens and spaces go. The code in UW-IMAP's c-client may also be useful by providing an example of how a C program might choose to represent the parsed data. > If someone could suggest a good way to parse this from a simple to > complex email message it would be greatly appreciated. To parse it: generate a parser from the ABNF grammar in RFC 3501, section 9. > I have tried both BODY and BODYSTRUCTURE with no luck on parsing it out > and building a segment table (ie: 1.1.1, 1.1.2, 2.1.1.2, ect) Actually, my recall is that the nesting of the 'body' grammar non-terminal exactly matches the nesting of section data numbers. I.e., if the top level 'body' has three immediately nest 'body' pieces, then 1, 2, and 3 are the valid top level section specifiers. Recurse from there... Philip Guenther |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Hello,
redragon@red-dragon.com wrote: > If someone could suggest a good way to parse this from a simple to > complex email message it would be greatly appreciated. > > I have tried both BODY and BODYSTRUCTURE with no luck on parsing it out > and building a segment table (ie: 1.1.1, 1.1.2, 2.1.1.2, ect) I guess, I didn't understand your question yet. First of all: If you are working on an email client using IMAP you should consult RFC 3501. I you want me to understand your point, you should write about what you really want to do. (e.g. Which language do you use? ...) Best Regards, Oliver |
|
![]() |
| Outils de la discussion | |
|
|