try { ParsedMessage pm = new ParsedMessage(mm, date, mbox.attachmentsIndexingEnabled()); Message msg = mbox.saveDraft(octxt, pm, id, origId, replyType);
ParsedMessage pm = new ParsedMessage(mm, date, mbox.attachmentsIndexingEnabled());
    public Element handle(Element request, Map<String, Object> context) throws ServiceException {        ZimbraSoapContext lc = getZimbraSoapContext(context);        Account acct = getRequestedAccount(lc);        Mailbox mbox = getRequestedMailbox(lc);        OperationContext octxt = lc.getOperationContext();        Element msgElem = request.getElement(MailService.E_MSG);        int id = (int) msgElem.getAttributeLong(MailService.A_ID, Mailbox.ID_AUTO_INCREMENT);        int origId = (int) msgElem.getAttributeLong(MailService.A_ORIG_ID, 0);        String replyType = msgElem.getAttribute(MailService.A_REPLY_TYPE, null);        // check to see whether the entire message has been uploaded under separate cover        String attachment = msgElem.getAttribute(MailService.A_ATTACHMENT_ID, null);        ParseMimeMessage.MimeMessageData mimeData = new ParseMimeMessage.MimeMessageData();        MimeMessage mm;        if (attachment != null)            mm = SendMsg.parseUploadedMessage(lc, attachment, mimeData);        else            mm = ParseMimeMessage.parseMimeMsgSoap(lc, mbox, msgElem, null, mimeData);        long date = System.currentTimeMillis();        try {            mm.setFrom(AccountUtil.getFriendlyEmailAddress(acct));            Date d = new Date();            mm.setSentDate(d);            date = d.getTime();        } catch (Exception e) { }        try {            mm.saveChanges();        } catch (MessagingException me) {            throw ServiceException.FAILURE("completing MIME message object", me);        }		try {		    ParsedMessage pm = new ParsedMessage(mm, date, mbox.attachmentsIndexingEnabled());			Message msg = mbox.saveDraft(octxt, pm, id, origId, replyType);            // we can now purge the uploaded attachments            if (mimeData.uploads != null)                FileUploadServlet.deleteUploads(mimeData.uploads);            Element response = lc.createElement(MailService.SAVE_DRAFT_RESPONSE);            // FIXME: inefficient -- this recalculates the MimeMessage (but SaveDraft is called rarely)            ToXML.encodeMessageAsMP(response, lc, msg, false, null);            return response;		} catch (IOException ioe) {			throw ServiceException.FAILURE("IOException while saving draft", ioe);        }    }