} else {
this.message.setText(this.body);
}
}
} else {
Multipart multipart = new MimeMultipart();
BodyPart bodypart = null;
if (this.body != null) {
bodypart = new MimeBodyPart();
bodypart.setText(this.body);
multipart.addBodyPart(bodypart);
}
this.message.setContent(multipart);
for (Iterator i = this.attachmentList.iterator(); i.hasNext();) {
a = (Attachment) i.next();
DataSource ds = null;
if (a.isURL) {
String name = (String) a.getObject();
Source src = resolver.resolveURI(name);
sourcesList.add(src);
if (src.exists()) {
ds = new SourceDataSource(
src,
a.getType(src.getMimeType()),
a.getName(name.substring(name.lastIndexOf('/') + 1)));
}
} else {
if (a.getObject() instanceof Part) {
Part part = (Part) a.getObject();
ds = new FilePartDataSource(
part,
a.getType(part.getMimeType()),
a.getName(part.getUploadName()));
} else {
// TODO: other classes?
throw new AddressException("Not yet supported: " + a.getObject());
}
}
bodypart = new MimeBodyPart();
bodypart.setDataHandler(new DataHandler(ds));
bodypart.setFileName(ds.getName());
multipart.addBodyPart(bodypart);
}
}
Transport.send(this.message);
} catch (MessagingException me) {