ismtp-3.0.1: Advanced ESMTP library

MaintainerErtugrul Soeylemez <>



Helper functions and types.



enumHandleTimeout :: MonadIO m => Int -> Int -> Handle -> Enumerator ByteString m b

Enumerate from a handle with the given buffer size (first argument) and timeout in milliseconds (second argument). If the timeout is exceeded a TimeoutError exception is thrown via throwError.

Note that this timeout is not a timeout for the whole enumeration, but for each individual read operation. In other words, this timeout protects against dead/unresponsive peers, but not against (perhaps intentionally) slowly sending peers.

formatMsgs :: Vector ByteString -> StringSource

Format a Vector of ByteString messages from an SmtpResponse for output.

smtpResponseLine :: Monad m => MaybeT r (Iteratee ByteString m) (Either ByteString (Integer, Bool, ByteString))Source

Read the next SMTP response line from the given ByteString lines stream (i.e. a ByteString stream converted by netLines). Returns Nothing on EOF. Returns Just (Left line), if the next line is not a proper SMTP response. Otherwise returns (code, more, msg).

smtpResponse :: forall m r. Monad m => Int -> MaybeT r (Iteratee ByteString m) SmtpResponseSource

Read the next SMTP response from a netLines-splitted ByteString stream. Throws an error on protocol errors. Returns at most the given number of response messages.

smtpResponses :: forall b m. Monad m => Int -> Enumeratee ByteString SmtpResponse m bSource

Convert a stream of netLines-splitted ByteString lines to a stream of SMTP responses. In case of a protocol error the enumeration is aborted and an error is thrown.

stringToExtension :: ByteString -> Maybe ExtensionSource

Convert extension string to Extension value, if the corresponding extension is known.