-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A simple SMTP client -- -- A simple SMTP client -- -- DARCS repository: http://blacksapphire.com/SMTPClient/ @package SMTPClient @version 0.1 module Network.SMTP.ClientSession -- | 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. smtpClientSession :: String -> [Message] -> SMTPState data SMTPState SMTPState :: [String] -> (String -> SMTPState -> SMTPState) -> Bool -> Maybe String -> Int -> SMTPState -- | 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"). smtpOutQueue :: SMTPState -> [String] -- | When 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. smtpReceive :: SMTPState -> String -> SMTPState -> SMTPState -- | When True, this flag indicates that the SMTP session has completed -- successfully and there is no more work to do. smtpSuccess :: SMTPState -> Bool -- | When Just err, this indicates that a protocol error has occurred, and -- that the caller must terminate the session. smtpFailure :: SMTPState -> Maybe String -- | The number of emails successfully sent so far. smtpSent :: SMTPState -> Int module Network.SMTP.Client -- | Send a list of email messages to an SMTP server. Throws SMTPException -- on failure at the communication protocol level. The message body may -- contain either "n" or "\r\n" for an end-of-line marker and in all -- cases it will be sent correctly to the server. sendSMTP :: String -> SockAddr -> [Message] -> IO () -- | Like sendSMTP_ but takes an additional function for logging all input -- and output for diagnostic purposes. Also an optional IORef for storing -- the number of emails sent so far. The emails are sent strictly in -- order, so this count can be used when an exception is caught to mark -- sent emails. sendSMTP_ :: (String -> IO ()) -> Maybe (IORef Int) -> String -> SockAddr -> [Message] -> IO () data SMTPException SMTPException :: String -> SMTPException instance Typeable SMTPException instance Eq SMTPException instance Show SMTPException instance Exception SMTPException