MimeMultipart mmp = (MimeMultipart)mm.getContent();   int numParts = mmp.getCount();  for (int i = 0; i < numParts; i++) { MimeBodyPart mbp = (MimeBodyPart)mmp.getBodyPart(i); String[] hdrs = mbp.getHeader("invId");  if (hdrs != null && hdrs.length > 0 && (Integer.parseInt(hdrs[0])==subId)) {  return (MimeMessage)mbp.getContent(); } } return null;
return mm;
    public MimeMessage getMimeMessage(int subId) throws ServiceException {        InputStream is = null;        MimeMessage mm = null;        try {            is = getRawMessage();            mm = new MimeMessage(JMSession.getSession(), is);            is.close();            try {                TnefConverter conv = new TnefConverter();                Mime.accept(conv, mm);            } catch (Exception e) {                // If the conversion bombs for any reason, revert to the original                ZimbraLog.mailbox.info(                    "Unable to convert TNEF attachment for message " + getId(), e);                is = getRawMessage();                mm = new MimeMessage(JMSession.getSession(), is);                is.close();            }                                    // it'll be multipart/digest            MimeMultipart mmp = (MimeMultipart)mm.getContent();                        // find the matching parts...            int numParts = mmp.getCount();                        for (int i = 0; i < numParts; i++) {                MimeBodyPart mbp = (MimeBodyPart)mmp.getBodyPart(i);                String[] hdrs = mbp.getHeader("invId");                                if (hdrs != null && hdrs.length > 0 && (Integer.parseInt(hdrs[0])==subId)) {                                        return (MimeMessage)mbp.getContent();                }            }            return null;        } catch (IOException e) {            throw ServiceException.FAILURE("IOException while getting MimeMessage for item " + mId, e);        } catch (MessagingException e) {            throw ServiceException.FAILURE("MessagingException while getting MimeMessage for item " + mId, e);        }    }