public void deleteMails ( String as [ ] , String as1 [ ] ) throws MessagingException , IOException { Folder folder ; Message amessage [ ] ; folder = _store . getFolder ( "INBOX" ) ; folder . open ( 2 ) ; Map < String , Message > map = getMessages ( null , folder , as1 , as , startrow , maxrows , false ) ; Iterator < String > iterator = map . keySet ( ) . iterator ( ) ; amessage = new Message [ map . size ( ) ] ; int i = 0 ; while ( iterator . hasNext ( ) ) { amessage [ i ++ ] = map . get ( iterator . next ( ) ) ; } try { folder . setFlags ( amessage , new Flags ( javax . mail . Flags . Flag . DELETED ) , true ) ; } finally { folder . close ( true ) ; } }
delete all message in ibox that match given criteria