messageBodyPart.setContent(mailBody, this.bodyMimeType);
} else {
messageBodyPart.setContent(this.body, this.bodyMimeType);
}
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
// process attachments
Iterator iterAtt = this.attachments.iterator();
while (iterAtt.hasNext()) {
AttachmentDescriptor aD = (AttachmentDescriptor) iterAtt.next();
messageBodyPart = new MimeBodyPart();
if (!aD.isTextContent()) {
Source inputSource = null;
DataSource dataSource = null;
if (aD.isURLSource()) {
inputSource = resolver.resolveURI(aD.strAttrSrc);
String iSS = inputSource.getURI();
if (iSS.startsWith("cocoon:")) {
iSS = iSS.substring(7, iSS.length());
if (this.contextPath != null) {
iSS = "http://localhost:" + this.port +
this.contextPath + iSS;
} else {
iSS = "http://localhost:" + this.port + iSS;
}
if (getLogger().isDebugEnabled()) {
getLogger().debug("cocoon-URI changed to " + iSS);
}
dataSource = new URLDataSource(new URL(iSS));
} else {
dataSource = new URLDataSource(new URL(inputSource.getURI()));
}
messageBodyPart.setDataHandler(new DataHandler(dataSource));
} else if (aD.isFileSource()) {
inputSource = resolver.resolveURI(aD.strAttrFile);
dataSource = new URLDataSource(new URL(inputSource.getURI()));
messageBodyPart.setDataHandler(new DataHandler(dataSource));
}
} else {
messageBodyPart.setContent(aD.strContent,
aD.strAttrMimeType);
}
messageBodyPart.setFileName(aD.strAttrName);
multipart.addBodyPart(messageBodyPart);
}
sm.setContent(multipart);
//sm.setReturnOption(SMTPMessage.RETURN_FULL);