How do I deal with a message whose content isn't "multipart"?
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   ray_lee
Posted On:   Wednesday, May 9, 2001 12:54 AM

When I tried to cast the content of a MimeMessage object to "Multipart", I got a exception which is showed below.


//exception


java.lang.ClassCastException: com.sun.mail.util.SharedByteArrayInputStream


// here is my code


// myMessage is a MimeMessage object


Object o = myMessage.getContent();


Multipart mp = (Multipart)o;




How do I solve it?


Thx

Re: How do I deal with a message whose content isn't "multipart"?

Posted By:   Abid_Farooqui  
Posted On:   Monday, June 18, 2001 08:34 AM

I have a similar problem. I am trying to automate detection of any attachment files using JavaMail. It works fine when Content-Type=multipart/* but I am receiving some e-mails from some clients whose Content-Type starts out by being application/octetstream, but the content disposition is attachment. In short this message is not of type multipart but does contain an attachment. An example is given below:


[Actual Message Below ... no master Content-Type=multipart/mixed set, no boundary for the MIME multipart message defined]


Received: from abc.cqb.com ([100.19.00.000])
by abcd739.ennet.net (Lotus Domino Release 5.0.6a)
with SMTP id 200100000000000:10 ;
Mon, 18 Jun 2001 07:21:39 -0700

Received: from xyz.somewhere.com (xyz.somewhere.com [195.000.000.000])
by id.com (8.9.3/8.9.3) with ESMTP id EAA00988
for ; Mon, 18 Jun 2001 04:34:35 -0700 (PDT)

Received: from xyz.somewhere.com (unverified) by xyz.somewhere.com
(Content Technologies SMTPRS 4.1.5) with ESMTP id for ;
Mon, 18 Jun 2001 12:29:41 +0100

Received: by xyz with Internet Mail Service (5.5.2653.19)
id ; Mon, 18 Jun 2001 12:35:33 +0100

Message-ID: <5367BFCA1746D511851200A0C9A7835216BD27@xyz>

From: someone@somedomain.com

Sender: sender@somedomain.com

To: someone@domain.com

Subject: some subject 16/06/01

Date: Mon, 18 Jun 2001 12:35:32

MIME-Version: 1.0

X-Mailer: Internet Mail Service (5.5.2653.19)

X-MIMETrack: Itemize by SMTP Server on enmail/ennet(Release 5.0.6a |January
17, 2001) at 06/18/2001 07:21:39 AM,
Serialize by POP3 Server on enmail/ennet(Release 5.0.6a |January
17, 2001) at 06/18/2001 07:31:00 AM,
Serialize complete at 06/18/2001 07:31:00 AM


Content-Type: application/octet-stream;
name="iaset_000_000.csv"
Content-Disposition: attachment;
filename="iaset_000_000.csv"


"Some attachment text here ..."

Re: How do I deal with a message whose content isn't &quot;multipart&quot;?

Posted By:   John_Zukowski  
Posted On:   Monday, May 14, 2001 10:47 PM

Check to see if the contents are a multipart before casting. See what type you have. Perhaps you don't have one.....

Re: How do I deal with a message whose content isn't &quot;multipart&quot;?

Posted By:   zaina_world  
Posted On:   Friday, May 11, 2001 11:02 AM

I have the same problem. If anyone has an idea, please let us know.
About | Sitemap | Contact