dcsimg
Attachment sent are not displayed properly?I am just sending it not displaying.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Veeraprakash_Gattina
Posted On:   Wednesday, May 30, 2001 02:27 AM

I am having the message as inputstream,I have written my own Datahandler class, message is sent perfectly without errors. when i go and check in my inbox of(hotmail or yahoo). The file name is displayed correctly,but when i try to view it everything is junk. Following is the code if any suggestions pl guide me :- ========================== InputStream is = part.getInputStream(); byte[] btes = new byte[512]; while (is.read(btes) != -1) { } MimeBodyPart bodyPart = new MimeBodyPart(); DataSource ds = new ByteArrayDataSource(btes,contentType,fileName); bodyPart.setDataHandler(new DataHandler(ds)); bodyPart.setDisposition("attachment; filename=""+fileName+   More>>

I am having the message as inputstream,I have written my own Datahandler class, message is sent perfectly without errors. when i go and check in my inbox of(hotmail or yahoo).
The file name is displayed correctly,but when i try to view it everything is junk.
Following is the code if any suggestions pl guide me :-
==========================
InputStream is = part.getInputStream();
byte[] btes = new byte[512];
while (is.read(btes) != -1)
{ }
MimeBodyPart bodyPart =
new MimeBodyPart();

DataSource ds = new ByteArrayDataSource(btes,contentType,fileName);
bodyPart.setDataHandler(new DataHandler(ds));
bodyPart.setDisposition("attachment; filename=""+fileName+""");
bodyPart.setFileName(fileName);
MimeMultipart multipart = new MimeMultipart();
multipart.addBodyPart(bodyPart);
msg1.setContent(multipart);
where msg1 is MimeMessage object.
===================================
If something is missing in above code pl let me know.

Veeraprakash.

   <<Less
About | Sitemap | Contact