Module Smtp


module Smtp: sig .. end
Module implementing SMTP protocol for client side. For example :
 
try   
   let h = Smtp.connect host in
   Smtp.helo h myhost && Smtp.mail h mymail &&
   Smtp.rctp h hismail && Smtp.data h msg &&
   Smtp.quit h;
   Smtp.close h
with
| Smtp.Error s ->
   Printf.printf "smtp error : %s\n" s;
   exit 1
   


type handle 
smtp server connection
exception Error of int * string
exception for the module
val connect : string -> handle
connect host return channels for the connection with host on smtp port
val close : handle -> unit
close h close the connection
val helo : handle -> string -> bool
helo h hostname send the HELO command thru the handle h and with hostname as argument. Return exception Error if smtp server give an error code.
val mail : handle -> string -> bool
mail h mail send a MAIL FROM command thru handle h and with mail as argument . Return exception Error if smtp server give an error code.
val rcpt : handle -> string -> bool
rcpt h mail send a RCPT TO command thru handle h and with mail as argument. Return exception Error if smtp server give an error code.
val data : handle -> string -> bool
data h msg send a DATA command and after the message msg. Return exception Error if smtp server give an error code.
val quit : handle -> bool
quit h send a QUIT command thru handle h. Return exception Error if smtp server give an error code.