Version française
Home     About     Download     Resources     Contact us    
Browse thread
Netmime: parsing a nested multipart message
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Johann Spies <jspies@s...>
Subject: Re: [Caml-list] Netmime: parsing a nested multipart message

 
On Tue, Jun 14, 2005 at 03:55:28PM +0200, Johann Spies wrote:

> 
> - : Netmime.complex_mime_message =
> (<obj>,
>  `Parts
>    [(<obj>, `Parts [(<obj>, `Body <obj>); (<obj>, `Body <obj>)]);
>     (<obj>, `Body <obj>); (<obj>, `Body <obj>); (<obj>, `Body <obj>)])
> 

Thanks to Remi Vanicat who helped me.  The following code seems to
work:

# let handle ( mesg :  Netmime.complex_mime_message) = match mesg with
      (header,`Body bb) ->  handle_simple_message mesg
  | (header, `Parts body) ->
      let rec aux body =
        match body with
            [] -> ()
          | (_ , `Body b)::_ ->
             if  not (List.mem("US-diclaimer", "added") header#fields)
	     then
               begin
                 add_header header;
                 add_disclaimer b;
                 writemessage mesg;
               end
          | (_, `Parts l)::_ -> aux l
      in
        aux body;
        writemessage mesg;;
val handle : Netmime.complex_mime_message -> unit = <fun>

Regards
Johann
-- 
Johann Spies          Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch

     "Cease from anger, and forsake wrath; do not fret-  
      it leads only to evil."        Psalms 37:8 


VRYWARING: Hierdie vrywaring is bloot 'n toets...  

DISCLAIMER:  This disclaimer was just added as a test...