Stability | experimental |
---|---|
Maintainer | Ertugrul Soeylemez <es@ertes.de> |
This module implements a monad for SMTP sessions.
- runMailT :: (Applicative m, Monad m) => Handle -> StringMailT (Either SomeException a) m a -> m (Either SomeException a)
- runMailT_ :: (Applicative m, MonadIO m) => Handle -> StringMailT (Either SomeException a) m a -> m a
- mailError :: Monad m => SmtpCommand -> String -> Integer -> Vector ByteString -> MailT r m a
- mailPut :: MonadIO m => Enumerator ByteString (MailT r m) () -> MailT r m ()
- mailPutLn :: MonadIO m => [ByteString] -> MailT r m ()
- nextResponse :: Monad m => MailT r m SmtpResponse
Running sessions
runMailT :: (Applicative m, Monad m) => Handle -> StringMailT (Either SomeException a) m a -> m (Either SomeException a)Source
Run a mail session computation with the given output handle. The
input is supplied by an Enumerator
such as enumHandleTimeout
.
runMailT_ :: (Applicative m, MonadIO m) => Handle -> StringMailT (Either SomeException a) m a -> m aSource
Run a mail session computation using runMailT
and throw an
exception on error.
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 ByteString
s to the SMTP server.
mailPutLn :: MonadIO m => [ByteString] -> MailT r m ()Source
Send a list of ByteString
s 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.