Network.SMTP.ClientSession
Description
A pure SMTP client state machine.
Data structures for representing SMTP status codes and email messages are re-exported here from Text.ParserCombinators.Parsec.Rfc2821 and Text.ParserCombinators.Parsec.Rfc2822 in the hsemail package.
- smtpClientSession :: String -> [Message] -> SMTPState
- data SMTPState = SMTPState {
- smtpOutQueue :: [String]
- smtpSuccess :: Bool
- smtpFailure :: Maybe String
- smtpReceive :: String -> SMTPState -> SMTPState
- smtpStatuses :: [Maybe SmtpReply]
- data SmtpReply = Reply SmtpCode [String]
- data SmtpCode = Code SuccessCode Category Int
- data SuccessCode
- data Category
- = Syntax
- | Information
- | Connection
- | Unspecified3
- | Unspecified4
- | MailSystem
- type Message = GenericMessage String
- data GenericMessage a = Message [Field] a
- data Field
- = OptionalField String String
- | From [NameAddr]
- | Sender NameAddr
- | ReturnPath String
- | ReplyTo [NameAddr]
- | To [NameAddr]
- | Cc [NameAddr]
- | Bcc [NameAddr]
- | MessageID String
- | InReplyTo [String]
- | References [String]
- | Subject String
- | Comments String
- | Keywords [[String]]
- | Date CalendarTime
- | ResentDate CalendarTime
- | ResentFrom [NameAddr]
- | ResentSender NameAddr
- | ResentTo [NameAddr]
- | ResentCc [NameAddr]
- | ResentBcc [NameAddr]
- | ResentMessageID String
- | ResentReplyTo [NameAddr]
- | Received ([(String, String)], CalendarTime)
- | ObsReceived [(String, String)]
- data NameAddr = NameAddr {}
Documentation
Construct a pure state machine for an SMTP client session. Caller must handle I/O. The message body may use either "\n" or "\r\n" as an end-of-line marker.
Constructors
SMTPState | |
Fields
|
data SmtpReply
An SMTP reply is a three-digit return code plus some
waste of bandwidth called "comments". This is what the
list of strings is for; one string per line in the reply.
show
will append an "\r\n
" end-of-line marker to
each entry in that list, so that the resulting string is
ready to be sent back to the peer.
Here is an example:
*Rfc2821> print $ Reply (Code Success MailSystem 0) ["worked", "like", "a charm" ] 250-worked 250-like 250 a charm
If the message is []
, you'll get a really helpful
default text.
data SmtpCode
Constructors
Code SuccessCode Category Int |
data SuccessCode
data Category
Constructors
Syntax | |
Information | |
Connection | |
Unspecified3 | |
Unspecified4 | |
MailSystem |
type Message = GenericMessage String
data GenericMessage a
This data type repesents a parsed Internet Message as defined in
this RFC. It consists of an arbitrary number of header lines,
represented in the Field
data type, and a message body, which may
be empty.
data Field
This data type represents any of the header fields defined in this RFC. Each of the various instances contains with the return value of the corresponding parser.
Constructors