SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
mc.setEnvelope(factory.getDefaultEnvelope());
mc.setDoingSwA(true);
Attachments attachments = mc.getAttachmentMap();
attachments.addDataHandler("cid1@test.org", new DataHandler("test1", "text/plain"));
attachments.addDataHandler("cid2@test.org", new DataHandler("test2", "text/plain"));
mc.setProperty(Constants.Configuration.MM7_COMPATIBLE, true);
OMOutputFormat format = new OMOutputFormat();
format.setDoingSWA(true);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
formatter.writeTo(mc, format, baos, true);