getContent will return a String if the content type is text/plain. You need to check the content type before you can cast to String or Multipart.
Steve > -----Original Message----- > From: Jm Seigneur [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 06, 2003 8:09 AM > To: 'James Users List' > Subject: PB with MimeMultipart multipart = (MimeMultipart) > message.getContent(); > > > Hello, > > I've seen in the archive that it is possible to get the > MimeMultipart of a new Mail like that: > > MimeMultipart multipart = (MimeMultipart) > mail.getMessage().getContent(); > > When I send an email with some binary file attached, I get a > java.lang.ClassCastException: java.lang.String. > > The reason I'd like to get the multipart is to discard the > attachment. > > My question is: > Why do I get this exception? > > Thanks, > > Jm > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
