Posted By:
Shannon_Moschetti
Posted On:
Thursday, June 7, 2001 04:17 PM
I added an attachment containing content from a stream(loaded into the bodypart via the ByteArrayDataSource class). When I send the message and view the attachment I get garbled nonsense rather than the ASCII text attachment I expected. Here's the code: MimeBodyPart messageBodyPart = null; DataSource source = null; Multipart multipart = new MimeMultipart(); while(rset.next()){ // Get query results for row doctype = rset.getString(1); byte[] content = LobUtil.getBlob(2, rset); // Create messageBodyPart = new MimeBodyPart(); source = new ByteArrayDataSource(content, doctype);
More>>
I added an attachment containing content from a stream(loaded into the bodypart via the ByteArrayDataSource class). When I send the message and view the attachment I get garbled nonsense rather than the ASCII text attachment I expected.
Here's the code:
MimeBodyPart messageBodyPart = null;
DataSource source = null;
Multipart multipart =
new MimeMultipart();
while(rset.next()){
// Get query results for row
doctype = rset.getString(1);
byte[] content = LobUtil.getBlob(2, rset);
// Create
messageBodyPart = new MimeBodyPart();
source = new ByteArrayDataSource(content, doctype);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(Integer.toString(count) + ".html");
multipart.addBodyPart(messageBodyPart);
count++;
}
....
// send message
doctype is text/plain and content is BLOB content from a database
Is there something I'm missing?
<<Less