So the following patch series is my attempt to improve handling of message/rfc822 parts. The first couple of patches fix/overhaul the multipart test, and the last two improve the message/rfc822 part output and emacs handling, respectively.
The fix outputs the rfc822 message in a format similar to that of the outer message, including "headers" and "body" fields. What this doesn't yet address is the raw output of message/rfc822 parts. The raw output of message/rfc822 parts /should/ be the full raw message. However, I have not yet figured out how to do that yet, so the multipart test for raw message/rfc822 parts is not yet fixed. The problem is really gmime's handling of message parts. There doesn't seem to be a gmime function that will return the message part as a GMimeObject. This means that we can't access all the message headers, or the messages sub parts as mime objects. There may be a way to hack around gmime's limitations, but I haven't figured it out yet. If someone else wants to take a crack at it, that would be great. In the mean time, I'm opening a bug report with gmime to request a function to return the rfc822 part as a GMimeObject. jamie.