@Override
protected void decode(MimeMultipartParser mpp, Packet packet) throws IOException {
// TODO: handle attachments correctly
Attachment root = mpp.getRootPart();
if (rootCodec instanceof RootOnlyCodec) {
((RootOnlyCodec)rootCodec).decode(root.asInputStream(),root.getContentType(),packet, new MimeAttachmentSet(mpp));
} else {
rootCodec.decode(root.asInputStream(),root.getContentType(),packet);
Map<String, Attachment> atts = mpp.getAttachmentParts();
for(Map.Entry<String, Attachment> att : atts.entrySet()) {
packet.getMessage().getAttachments().add(att.getValue());