From 89c232a6f94d82bf920c774ff6c89161980108b8 Mon Sep 17 00:00:00 2001 From: hns Date: Tue, 11 Jun 2002 16:30:43 +0000 Subject: [PATCH] addPart() now takes just one part at a time, but accepts the file name to use for the part as second argument. Also, it accepts instances of helma.util.MimePart, which are used in HTTP file uploads and teh global getURL() function. setText() now plays together nicely with addPart(). If both plain text and MIME parts are set for a message, the text will be added as plain text at the beginning of the message. --- .../scripting/fesi/extensions/ESMail.java | 58 ++++++++++++++----- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/src/helma/scripting/fesi/extensions/ESMail.java b/src/helma/scripting/fesi/extensions/ESMail.java index dbc3c4e6..f5adb422 100644 --- a/src/helma/scripting/fesi/extensions/ESMail.java +++ b/src/helma/scripting/fesi/extensions/ESMail.java @@ -4,8 +4,17 @@ package helma.scripting.fesi.extensions; -import javax.mail.*; -import javax.mail.internet.*; +import javax.mail.Session; +import javax.mail.Multipart; +import javax.mail.Address; +import javax.mail.Transport; +import javax.mail.Message; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeUtility; +import javax.mail.internet.MimeMultipart; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.AddressException; import javax.activation.*; import java.io.*; import java.util.*; @@ -86,21 +95,29 @@ public class ESMail extends ESObject implements Serializable { } public void addPart (ESValue val[]) throws Exception { - if (val == null || val.length == 0) return; + if (val == null || val.length == 0 || val.length > 2) + throw new IOException ("mail.addPart called with wrong number of arguments."); if (multipart == null) { multipart = new MimeMultipart (); } - for (int i=0; i