SMTPClient-0.2: A simple SMTP clientSource codeContentsIndex
Network.SMTP.ClientSession
Synopsis
smtpClientSession :: String -> [Message] -> SMTPState
data SMTPState = SMTPState {
smtpOutQueue :: [String]
smtpReceive :: String -> SMTPState -> SMTPState
smtpSuccess :: Bool
smtpFailure :: Maybe String
smtpSent :: Int
}
Documentation
smtpClientSessionSource
:: StringDomain name used in EHLO command
-> [Message]List of messges to send
-> SMTPState
Pure state machine for an SMTP client session. Caller must handle I/O. The message body may contain either "n" or "\r\n" for an end-of-line marker. All are stripped before passing to caller for dispatch.
data SMTPState Source
Constructors
SMTPState
smtpOutQueue :: [String]Caller must output any lines queued up in this list, making sure to clear them in the state passed back to smtpReceive. These lines are in reverse order, so the caller must reverse them before processing. They do not have end-of-line characters, so the caller must add "\r\n" on the end (as required by RFC2821 - not just "\n").
smtpReceive :: String -> SMTPState -> SMTPStateWhen there is nothing to send, the caller should wait for a line from the SMTP server, strip any end-of-line characters, and pass it to this function for processing.
smtpSuccess :: BoolWhen True, this flag indicates that the SMTP session has completed successfully and there is no more work to do.
smtpFailure :: Maybe StringWhen Just err, this indicates that a protocol error has occurred, and that the caller must terminate the session.
smtpSent :: IntThe number of emails successfully sent so far.
Produced by Haddock version 2.6.0