This could be a very na�ve implementation, I think it was based on code from
here:

http://java.sun.com/developer/onlineTraining/JavaMail/contents.html#GettingA
ttachments


-- Bud

> -----Original Message-----
> From: Hong Zheng [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 19, 2005 5:21 PM
> To: 'James Users List'
> Subject: RE: mail attachement
> 
> Just curious. Did you try to use the codes on large attachments? I think
> most likely you would get an out of mem error due to the way JavaMail is
> implemented.
> 
> Hong :)
> 
> -----Original Message-----
> From: Bud Bach [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 19, 2005 5:47 PM
> To: 'James Users List'
> Subject: RE: mail attachement
> 
> Something along the lines of this may work:
> 
>       MimeMessage msg = (MimeMessage) mail.getMessage();
>       Multipart mp = (Multipart) msg.getContent();
>       for (int i = 0; i < mp.getCount(); i++) {
>               Part part = mp.getBodyPart(i);
>               String fileName = part.getFileName();
>               String disposition = part.getDisposition();
>               if (disposition == "attachment") {
>                       DataHandler dh = part.getDataHandler();
>                       FileOutputStream fos = new
> FileOutputStream(fileName);
>                       dh.writeTo(fos);
>               }
>       }
> 
> -- Bud
> > -----Original Message-----
> > From: Thibaut L. [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, May 19, 2005 10:49 AM
> > To: [email protected]
> > Subject: mail attachement
> >
> > hi, i'd like to extact attach file from a incoming mail.
> > I tried mail.getMessage().getDataHandler() but i can't go further ...
> > What is the right way to extract a file from a mail in my mailet ?
> >
> > thanks
> >
> >
> > ---------------------------------------------------------------------
> > 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]
> 
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to