if (getHasUploadParts()) { Part[] parts = getUploadParts().toArray(new Part[getUploadParts().size()]); m.setAttachmentUploadId(mailbox.doUpload(parts, 1000*60)); }
    public ZOutgoingMessage toOutgoingMessage() throws ServiceException {        List<ZEmailAddress> addrs = new ArrayList<ZEmailAddress>();        if (mTo != null && mTo.length() > 0)            addrs.addAll(ZEmailAddress.parseAddresses(mTo, ZEmailAddress.EMAIL_TYPE_TO));        if (mReplyTo != null && mReplyTo.length() > 0)            addrs.addAll(ZEmailAddress.parseAddresses(mReplyTo, ZEmailAddress.EMAIL_TYPE_REPLY_TO));        if (mCc != null && mCc.length() > 0)            addrs.addAll(ZEmailAddress.parseAddresses(mCc, ZEmailAddress.EMAIL_TYPE_CC));        if (mFrom != null && mFrom.length() > 0)            addrs.addAll(ZEmailAddress.parseAddresses(mFrom, ZEmailAddress.EMAIL_TYPE_FROM));        if (mBcc != null && mBcc.length() > 0)            addrs.addAll(ZEmailAddress.parseAddresses(mBcc, ZEmailAddress.EMAIL_TYPE_BCC));        ZOutgoingMessage m = new ZOutgoingMessage();                if (mMessageAttachments != null && mMessageAttachments.size() > 0) {            List<String> messages = new ArrayList<String>();            for (MessageAttachment ma : mMessageAttachments) {                messages.add(ma.getId());            }            m.setMessageIdsToAttach(messages);        }        if (mCheckedAttachmentNames != null && mCheckedAttachmentNames.size() > 0) {            List<AttachedMessagePart> attachments = new ArrayList<AttachedMessagePart>();            for (Map.Entry<String,Boolean> entry : mCheckedAttachmentNames.entrySet()) {                if (entry.getValue())                    attachments.add(new AttachedMessagePart(mMessageId, entry.getKey()));            }            m.setMessagePartsToAttach(attachments);        }        /*        if (mOriginalAttachments != null && mOriginalAttachments.size() > 0) {            List<AttachedMessagePart> attachments = m.getMessagePartsToAttach();            if (attachments == null) attachments = new ArrayList<AttachedMessagePart>();            for (ZMimePartBean part : mOriginalAttachments) {                attachments.add(new AttachedMessagePart(mMessageId, part.getPartName()));            }            m.setMessagePartsToAttach(attachments);        }        */        m.setAddresses(addrs);        m.setSubject(mSubject);        if (mInReplyTo != null && mInReplyTo.length() > 0)            m.setInReplyTo(mInReplyTo);        m.setMessageParts(new ArrayList<MessagePart>());        m.getMessageParts().add(new MessagePart(mContentType, mContent));        if (mMessageId != null && mMessageId.length() > 0)            m.setOriginalMessageId(mMessageId);        if (mReplyType != null && mReplyType.length() > 0)            m.setReplyType(mReplyType);        m.setMessageParts(new ArrayList<MessagePart>());        m.getMessageParts().add(new MessagePart(mContentType, mContent != null ? mContent : ""));        return m;    }