Fixed multipart messages.

This commit is contained in:
hns 2001-08-27 16:29:47 +00:00
parent 37a50b548f
commit 027568007e

View file

@ -9,7 +9,7 @@ import javax.mail.internet.*;
import javax.activation.*; import javax.activation.*;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import helma.objectmodel.IServer; import helma.main.Server;
import helma.framework.core.*; import helma.framework.core.*;
import helma.util.*; import helma.util.*;
import FESI.Data.*; import FESI.Data.*;
@ -57,7 +57,7 @@ public class ESMail extends ESObject implements Serializable {
Session session = Session.getDefaultInstance(props, null); Session session = Session.getDefaultInstance(props, null);
message = new MimeMessage (session); message = new MimeMessage (session);
} catch (Throwable t) { } catch (Throwable t) {
IServer.getLogger().log ("caught in mail constructor: "+t); Server.getLogger().log ("caught in mail constructor: "+t);
} }
} }
@ -95,20 +95,15 @@ public class ESMail extends ESObject implements Serializable {
} }
for (int i=0; i<val.length; i++) { for (int i=0; i<val.length; i++) {
// FIXME: addPart is broken. // FIXME: addPart is broken.
/* MimePart mp = null; MimeBodyPart part = new MimeBodyPart ();
if (mp != null) { Object obj = val[i].toJavaObject ();
BodyPart part = new MimeBodyPart (); if (obj instanceof String) {
IServer.getLogger().log ("Adding MimePart: "+mp.getContentType ()); part.setContent (obj.toString (), "text/plain");
MimePartDataSource ds = new MimePartDataSource (mp); } else if (obj instanceof File) {
part.setDataHandler (new DataHandler(ds)); FileDataSource source = new FileDataSource ((File) obj);
// part.setFileName(filename); part.setDataHandler (new DataHandler (source));
// part.setDataHandler (new javax.activation.DataHandler (mp.getContent(), mp.getContentType ())); }
multipart.addBodyPart (part); multipart.addBodyPart (part);
} else if (val[i] != null) {
BodyPart part = new MimeBodyPart ();
part.setContent (val[i].toString (), "text/plain");
multipart.addBodyPart (part);
} */
} }
} }