Problems stripping attachments from mime encoded e-mail using java mail. Does anyone know whats going on here?!
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Wednesday, July 24, 2002 08:42 PM

I am trying to strip the attachments from an e-mail that is saved to a file. I have checked that all the required header information and encoded blocks of data (for the attachments) are there in the file. My code is the following: File dataFile = new File(filePath); FileDataSource fds = new FileDataSource(filePath); try { MimeMultipart mp = new MimeMultipart(fds); for (int i=0, n= mp.getCount(); i Part part = mp.getBodyPart(i); String disposition = part.getDisposition(); if ((disposition != null) && ((disposition.equals(Part.ATTACHMENT) || (disposition.equals(Part.INLINE))))){ try { saveFile(fileOutputPath, part.getFileName(),    More>>


I am trying to strip the attachments from an e-mail that is saved to a file. I have checked that all the required header information and encoded blocks of data (for the attachments) are there in the file.


My code is the following:


			
File dataFile = new File(filePath);
FileDataSource fds = new FileDataSource(filePath);
try {
MimeMultipart mp = new MimeMultipart(fds);
for (int i=0, n= mp.getCount(); i
Part part = mp.getBodyPart(i);
String disposition = part.getDisposition();
if ((disposition != null) && ((disposition.equals(Part.ATTACHMENT) || (disposition.equals(Part.INLINE))))){

try {
saveFile(fileOutputPath, part.getFileName(), part.getInputStream()); //save the attached file
....

Running this code gives me the error:
problem getting content; message exception
javax.mail.MessagingException: Missing start boundary
at javax.mail.internet.MimeMultipart.parse(MimeMultipart.java:284)
at javax.mail.internet.MimeMultipart.getCount(MimeMultipart.java:159)
at MimeExtractor.extractMimeBits(MimeExtractor.java:22)
at MimeExtractor.main(MimeExtractor.java:103)

Help meeeeeee :)
Thanks Java Guru's
   <<Less
About | Sitemap | Contact