hi, thank you for your help !
i tried to extract the mail body too with mail.getMessage().getContent() but this works only for text email and not for html email. Do you have a solution for that too ?


thanks

Bud Bach a �crit :

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]



Reply via email to