tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daxin Zuo" <>
Subject Sending email with zip file attach problem
Date Mon, 24 Jan 2005 18:48:33 GMT

   Please help. Any sugestion is welcome. In my web page, users send email
with attachment, so upload is related. I can provide the file in either a
byte[] array, or in an inputstream. I try to send the attachement with
JavaMail(I know there is email api in Tomcat-Common. But I have no a good

--- my code in a function in a servlet  ---
DiskFileUpload upload = new DiskFileUpload();
List items = upload.parseRequest(request);
Iterator itr = items.iterator();
item = (FileItem);
//----- now it is a attachement. ----
InputStream istrm= item.getInputStream();
... ....
MimeBodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(strBodyText, "text/plain");
MimeMultipart multipart = new MimeMultipart();
messageBodyPart = new MimeBodyPart(istrm);
messageBodyPart.addHeader("Content-Type",strMime); //strMime is correct

NO metter what file it is, the attachement received is ATT00211.txt.
I the file is a text file, the contents are correct.
if the file is a small zip file, it adds the lines as following in attached
Content-Type: application/zip;
Content-Disposition: attachment;
Content-Transfer-Encoding: 7bit

What's wrong? Please forward instruction.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message