Module Netpop

module Netpop: sig .. end

This is an interface for the Post Office Protocol - Version 3 (POP3) as specifed by RFC 1939. The protocol is intended to permit a workstation to dynamically access a maildrop on a server host in a useful fashion.


type state = [ `Authorization | `Transaction | `Update ] 
exception Protocol_error
exception Authentication_error
exception Err_status of string
exception Bad_state
val tcp_port : int

Default TCP port for POP version 3

class client : Netchannels.in_obj_channel -> Netchannels.out_obj_channel -> object .. end

The class client implements the POP3 protocol.

class connect : ?proxy:#Uq_engines.client_endpoint_connector -> Uq_engines.connect_address -> float -> client

connect addr timeout: Connects with the server at addr, and configure that I/O operations time out after timeout seconds of waiting.

val authenticate : ?tls_config:Netsys_crypto_types.tls_config ->
?tls_required:bool ->
?tls_peer:string ->
?sasl_mechs:Netsys_sasl.sasl_mechanism list ->
?sasl_params:(string * string * bool) list ->
?user:string ->
?authz:string -> ?creds:Netsys_sasl.credentials -> client -> unit

Authenticates the session:

Options:

You can get a simple TLS configuration with:

let tls_config =
  Netsys_tls.create_x509_config
    ~system_trust:true
    ~peer_auth:`Required
    (Netsys_crypto.current_tls())
     

SASL example:

Netpop.authenticate
  ~sasl_mechs:[ (module Netmech_scram_sasl.SCRAM_SHA1);
                (module Netmech_digest_sasl.DIGEST_MD5);
              ]
  ~user:"tom"
  ~creds:[ "password", "sEcReT", [] ]
  client

Debugging

module Debug: sig .. end