Error in cast to MULTIPART

Hi, I test the follow Jguru tutorial code for getting atacchements

-

Multipart multipart = (Multipart)message.getContent();

for (int i=0, n=multipart.getCount(); i<n; i++) {

Part part = multipart.getBodyPart(i));

String disposition = part.getDisposition();

if ((disposition != null) &&

((disposition.equals(Part.ATTACHMENT) ||

(disposition.equals(Part.INLINE))) {

saveFile(part.getFileName(), part.getInputStream());

}

}

But i have a problem of cast in this line

Multipart mp = (Multipart)message.getContent();

the error of CastClass is:

java.lang.String cannot be cast to javax.mail.Multipart

why? Please help me

Thanks>

[750 byte] By [Fireantologya] at [2007-11-27 5:41:25]
# 1
Most likely you don't have a multipart message. See the msgshow.javademo program that comes with JavaMail.
bshannona at 2007-7-12 15:18:53 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
Ok, thanks.
Fireantologya at 2007-7-12 15:18:53 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...