ismtp-2.0.2: 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 an exception is thrown via throwError.

formatMsgs :: Vector ByteString -> StringSource

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

netLine :: Monad m => Int -> Iteratee ByteString m (Maybe ByteString)

Get the next nonempty line from the stream using netLineEmpty.

netLines :: Monad m => Int -> Enumeratee ByteString ByteString m b

Convert a raw byte stream to a stream of lines based on netLine.

responseLines :: Monad m => Int -> Int -> Iteratee SmtpResponse m b -> Iteratee ByteString m bSource

Composition of all Enumeratees, which are needed to convert a raw ByteString stream to an SmtpResponse stream. This function takes the maximum line length and the response line limit as its first two parameters.

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.