Alternative ways to parse a MimeMultipart message?
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Pasha_Paterson
Posted On:   Friday, October 11, 2002 06:31 AM

I'm trying to extract a PDF attachment from an auto-generated email, decode it, and save it to disk. I figured the code would be sort of simple: MimeMultipart msg = new MimeMultipart( msg_ds ) ; MimeBodyPart msg_pdf = null ; try {   if( msg.getCount() > 0 )     msg_pdf = (MimeBodyPart)(msg.getBodyPart(1)) ;   // other stuff... } catch( Exception e ) { e.printStackTrace() ; } The data source I'm working with is a FileDataSource bound to a plaintext dump of the email message. When I try to run the PDF extractor class using one of these dump files, I get the following error:   More>>

I'm trying to extract a PDF attachment from an auto-generated email, decode it, and save it to disk. I figured the code would be sort of simple:




MimeMultipart msg = new MimeMultipart( msg_ds ) ;

MimeBodyPart msg_pdf = null ;



try {

  if( msg.getCount() > 0 )

    msg_pdf = (MimeBodyPart)(msg.getBodyPart(1)) ;

  // other stuff...

}

catch( Exception e ) { e.printStackTrace() ; }



The data source I'm working with is a FileDataSource bound to a plaintext dump of the email message. When I try to run the PDF extractor class using one of these dump files, I get the following error:




javax.mail.MessagingException: Missing start boundary

at javax.mail.internet.MimeMultipart.parse(MimeMultipart.java:284)

at javax.mail.internet.MimeMultipart.getBodyPart(MimeMultipart.java:172)

at [my class].run([my class]:114)



Is there some other way to extract the fragments of the email without having to reinvent the MimeMultipart wheel?

   <<Less

Re: Alternative ways to parse a MimeMultipart message?

Posted By:   Anonymous  
Posted On:   Friday, November 1, 2002 08:33 AM


maybe using the
javax.mail.internet.MimePartDataSource will solve the problem.

Re: Alternative ways to parse a MimeMultipart message?

Posted By:   Christopher_Koenigsberg  
Posted On:   Friday, October 11, 2002 07:02 AM

javax.mail.MessagingException: Missing start boundary



Sounds like maybe your "plaintext dump of the message" is not complete?

About | Sitemap | Contact