chickadee » smtp » start-session

start-sessionprocedure

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))
  (StartData)
  (NeedHeloFirst)
  (NeedMailFromFirst)
  (NeedRcptToFirst)
  (NotImplemented) ;; Turn, Send, Soml, Saml, Vrfy, Expn.
  (ResetState)
  (SayOK)
  (SeeksHelp    (s string?))
  (Shutdown)
  (SyntaxErrorIn (s string?))
  (Unrecognized  (s string?)))