ismtp-3.0.1: Advanced ESMTP library

MaintainerErtugrul Soeylemez <>




This module implements a monad for SMTP sessions.


Running sessions

runMailT :: (Applicative m, Monad m) => Int -> Int -> Handle -> MailT a m a -> Iteratee ByteString m aSource

Run a mail session computation with the given protocol line length limit (first argument), response lines limit (second argument) and output handle. The input is supplied by an Enumerator such as enumHandleTimeout.

The inner iteratee uses SmtpResponse as its input type and hence expects the netLines and smtpResponses enumeratees to be applied. This is done by runMailT for you, so the resulting iteratee takes a raw ByteString stream as input.

Manipulating sessions

mailSetWriteTimeout :: Int -> MailT r m ()Source

Set the write timeout for the current mail session in milliseconds.

Utility functions

mailError :: Monad m => SmtpCommand -> String -> Integer -> Vector ByteString -> MailT r m aSource

Format a bad response together with the supplied error message and throw an SmtpException in the underlying Iteratee.

mailPut :: MonadIO m => Enumerator ByteString (MailT r m) () -> MailT r m ()Source

Send a stream of ByteStrings to the SMTP server.

mailPutLn :: MonadIO m => [ByteString] -> MailT r m ()Source

Send a list of ByteStrings followed an SMTP line terminator to the SMTP server.

nextResponse :: Monad m => MailT r m SmtpResponseSource

Retrieve the next SMTP response. Throw an Error, if there is no next response.