smtp-mail-ng- An SMTP client EDSL

Safe HaskellNone






data SMTP a Source

An SMTP client EDSL: it can do effects, things can go wrong, and it carries state.

smtp :: SMTPParameters -> SMTP a -> IO (Either SMTPError a) Source

Run an expression in the SMTP monad. Should be exception safe, but I am not confident in this.

command :: Command -> SMTP () Source

Send a command, without waiting for the reply.

bytes :: ByteString -> SMTP () Source

Send some bytes, with a crlf inserted at the end, without waiting for the reply.

expect :: ([ReplyLine] -> Maybe SMTPError) -> SMTP () Source

Pull a response from the server, passing it through a function which checks that it's an expected response. If the response doesn't parse as an SMTP response, we give an UnexpectedResponse.

expectCode :: ReplyCode -> SMTP () Source

Like expect, but you give only the ReplyCode that is expected. Any other reply code, or an unexpected reponse, is considered a failure.

data SMTPContext Source

Description of the state which an SMTP term needs in order to be evaluated.

smtpContext :: SMTP SMTPContext Source

Grab the SMTPContext.

startTLS :: SMTP () Source

Try to get TLS going on an SMTP connection.

data SMTPError Source

Description of an error in the SMTP monad evaluation.