[Apologies for the cross-post]. Does anyone know of existing code to convert/format/flatten an email.Message into the correct format for IMAP's BODYSTRUCTURE request? (it basically breaks down all the MIME parts of the message). It can use twisted or imaplib, or neither, I don't care. Thanks, Tony Meyer