MimeBodyPart part = new MimeBodyPart (); Object obj = val[i].toJavaObject (); if (obj instanceof String) { part.setContent (obj.toString (), "text/plain"); } else if (obj instanceof File) { FileDataSource source = new FileDataSource ((File) obj); part.setDataHandler (new DataHandler (source)); } multipart.addBodyPart (part);
    public void addPart (ESValue val[]) throws Exception {    	if (val == null || val.length == 0) return;    	if (multipart == null) {    	    multipart = new MimeMultipart ();    	}    	for (int i=0; i<val.length; i++) {    	    // FIXME: addPart is broken.	    /* MimePart mp = null;	    if (mp != null) {	        BodyPart part = new MimeBodyPart ();	        IServer.getLogger().log ("Adding MimePart: "+mp.getContentType ());	        MimePartDataSource ds = new MimePartDataSource (mp);	        part.setDataHandler (new DataHandler(ds));	        // part.setFileName(filename);	        // part.setDataHandler (new javax.activation.DataHandler (mp.getContent(), mp.getContentType ()));	        multipart.addBodyPart (part);	    } else if (val[i] != null) {	        BodyPart part = new MimeBodyPart ();	        part.setContent (val[i].toString (), "text/plain");	        multipart.addBodyPart (part);	    } */	}    }