From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA19830; Tue, 20 Jan 2004 14:12:40 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA19819 for ; Tue, 20 Jan 2004 14:12:38 +0100 (MET) Received: from maties3.sun.ac.za (maties3.sun.ac.za [146.232.128.43]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id i0KDCav22287 for ; Tue, 20 Jan 2004 14:12:37 +0100 (MET) Received: from bywoner.sun.ac.za ([146.232.129.121]) by maties3.sun.ac.za with esmtp (Exim 4.10) id 1AivgG-0006B6-00 for caml-list@inria.fr; Tue, 20 Jan 2004 15:12:32 +0200 Received: from js by bywoner.sun.ac.za with local (Exim 3.35 #1 (Debian)) id 1AivgG-00061F-00 for ; Tue, 20 Jan 2004 15:12:32 +0200 Date: Tue, 20 Jan 2004 15:12:31 +0200 From: Johann Spies To: caml-list@inria.fr Subject: [Caml-list] Netmime: splitting email attachments Message-ID: <20040120131231.GE22271@sun.ac.za> Mail-Followup-To: Johann Spies , caml-list@inria.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.5.1+cvs20040105i X-Scanner: exiscan for exim4 (http://duncanthrax.net/exiscan/) *1AivgG-0006B6-00*5HMFCAP5Vzc* X-Loop: caml-list@inria.fr X-Spam: no; 0.00; johann:01 spies:01 jspies:01 netmime:01 beginners:01 netmime:01 netstream:01 netchannels:01 val:01 val:01 johann:01 spies:01 universiteit:01 stellenbosch:01 whereby:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I have asked a similar question on ocaml_beginners, but did not get any reaction. I want to split attachments containing messages I want to feed to SA-learn into different files. I have spent hours now to try and understand the documentation of netmime and family of classes/modules. I would appreciate some help please. Fortunately I saw one or two examples in the documentation which helped me so far. I have come so far: # let readmessage f = Netmime.read_mime_message (new Netstream.input_stream (new Netchannels.input_channel (open_in f)));; val readmessage : string -> Netmime.complex_mime_message = # let ss = readmessage "/tmp/aa" ;; val ss : Netmime.complex_mime_message = (, `Parts [(, `Body ); (, `Body ); (, `Body ); (, `Body ); (, `Body )]) # let a,b = ss;; val a : Netmime.mime_header = val b : Netmime.complex_mime_body = `Parts [(, `Body ); (, `Body ); (, `Body ); (, `Body ); (, `Body )] What I want to do is to save each of the "Parts" in "b" in a seperate file. But I don't know how to proceed to get the contents of the list. In other words how do I get the tuples in "b" as strings? Regards Johann -- Johann Spies Telefoon: 021-808 4036 Informasietegnologie, Universiteit van Stellenbosch "Neither is there salvation in any other; for there is none other name under heaven given among men, whereby we must be saved." Acts 4:12 ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners