Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Netmime: splitting email attachments
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-01-20 (13:12)
From: Johann Spies <jspies@s...>
Subject: [Caml-list] Netmime: splitting email attachments
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 = <fun>
# let ss = readmessage "/tmp/aa" ;;
val ss : Netmime.complex_mime_message =
    [(<obj>, `Body <obj>); (<obj>, `Body <obj>); (<obj>, `Body <obj>);
     (<obj>, `Body <obj>); (<obj>, `Body <obj>)])
# let a,b = ss;;
val a : Netmime.mime_header = <obj>
val b : Netmime.complex_mime_body =
    [(<obj>, `Body <obj>); (<obj>, `Body <obj>); (<obj>, `Body <obj>);
     (<obj>, `Body <obj>); (<obj>, `Body <obj>)]

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? 


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 Archives:
Bug reports: FAQ:
Beginner's list: