/** * parse a MIME message, calling the builder methods that correspond to the message's header * fields and body parts. */ OutboundMessageIF parse(MIMEMessage msg) { this.msg = msg; builder = MessageBuilder.getInstance(getDestination()); MessagePart hdr = nextHeader(); while (hdr != null) { if (hdr.getName().equalsIgnoreCase("to")) builder.to((String) hdr.getValue()); else if (hdr.getName().equalsIgnoreCase("from")) builder.from((String) hdr.getValue()); // ... hdr = nextHeader(); } // while hdr MessagePart bdy = nextBodyPart(); while (bdy != null) { if (bdy.getName().equals("text/plain")) builder.plainText((String) bdy.getValue()); // ... else if (bdy.getName().equals("image/jpeg")) builder.jpegImage((Image) bdy.getValue()); // ... bdy = nextHeader(); } // while bdy return builder.getOutboundMsg(); } // parse(MIMEMessage)