mail_fetchstructure() (or one of its alternative forms) is most certainly
the correct thing to get the body structure of a message and run it down.
You certainly should not be playing with any driver settings either.
Have you tried running the mtest tool (bundled with the UW IMAP toolkit)
on the message in question? What does the 'B' command in that tool say
about the bodystructure? Does it show the multipart or does it show a
text part?
Also, note that the proper test for an encapsulated message is *NOT*
body->type == TYPEMESSAGE
but rather is
(body->type == TYPEMESSAGE) && !strcmp (body->subtype,"RFC822")
That is, non-RFC822 subtypes of TYPEMESSAGE should be treated like
TYPETEXT and not as an encapsulated message.
On Tue, 12 Feb 2008, Patrick Hamel (path) wrote:
Hi,
I'm not sure I'm doing something wrong but just in case, let me bounce
that off of the experts.
I'm trying to walk all the parts of a multipart message. One of the part
is a message/rfc822 part which contains a multipart message too.
So the code I have looks a little like this:
BODY *body = null;
ENVELOPE *env = mail_fetchstructure(stream, msgNo, &body);
...
and then loop when the type is a multipart message:
PART * curPart = body->nested.part;
while( curPart ) {
// dig
BODY *curBody = curPart->body;
... then when the type for the curBody is TYPEMESSAGE
if( curBoy->type == TYPEMESSAGE ) {
.. we should be able to get to the enclosed body like so:
MESSAGE *msg = curBody->nested.msg;
BODY *msgBody = msg->body;
... and more stuff to do
}
}
That's a bit stylized but you get the general idea.
So in the handling of the TYPEMESSAGE body (msgBody) when the email
sends an enclosed message which is also a multipart message; instead of
getting msgBody->type == TYPEMULTIPART, I get TYPETEXT; and the various
pointers to nested.part, bodies and what not are all null. The enclosed
mail handled as one plain text element (including email headers).
Is mail_fetchstructure the wrong thing to use?
Is this some driver setting I need to configure to get the 'downlevel'
multipart parsed into the structure?
Is there a way to get the TYPETEXT data re-parsed; kind of getting a
ENVELOPE and BODY (maybe?) from the msgBody.content.text.data?
Thanks,
PatH
-- Mark --
http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.
_______________________________________________
Imap-uw mailing list
[email protected]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw