chickadee » smtp » start-session


Procedure start-session returns an ESMTP state machine object (a procedure), which takes in a stream containing an SMTP command and returns an appropriate session-fsm value:

 (define-datatype session-fsm session-fsm?
   (Event (ev event?))
   (Trans (ev event?) (fsm procedure?)))

A stream in this case is defined as the representation used by the abnf library.

The Event variant signals an event that must be processed by the calling library, while Trans signals an event and a state machine transition. The following events can be returned by this state machine:

(define-datatype event event?
  (SayHelo       (s string?))
  (SayHeloAgain  (s string?))
  (SayEhlo       (s string?))
  (SayEhloAgain  (s string?))
  (SetMailFrom   (m mailbox?) (parameters? list))
  (AddRcptTo     (m mailbox?) (parameters? list))
  (NotImplemented) ;; Turn, Send, Soml, Saml, Vrfy, Expn.
  (SeeksHelp    (s string?))
  (SyntaxErrorIn (s string?))
  (Unrecognized  (s string?)))