You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br> on 2004/04/08 00:43:12 UTC

Removing attachments from messages.

How can I do it ?
This is the code I wrote on a test mailet.

MimeMessage message = mail.getMessage();
Multipart mp = (Multipart) message.getContent();    
for(int i=0; i<mp.getCount(); i++) 
{
   Part part = mp.getBodyPart(i);
   String disposition = part.getDisposition();
   if(disposition != null && (disposition.equals(Part.ATTACHMENT)))
   {
      MimeMultipart mmp =(MimeMultipart) mp;
      mmp.removeBodyPart(i);
      i--;
   }
}
message.saveChanges();   

-- 
Leandro Rodrigo Saad Cruz
InterBusiness Tecnologia e Serviços
IB    - www.ibnetwork.com.br
DB    - www.digitalbrand.com.br
OJB   - db.apache.org/ojb
XINGU - xingu.sf.net


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


RE: Removing attachments from messages.

Posted by "Noel J. Bergman" <no...@devtech.com>.
> How can I do it ?

You might want to join the JavaMail Interest mailing list, which provides a
place for JavaMail-specific questions.

	--- Noel


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org