Maintainer | Ertugrul Soeylemez <es@ertes.de> |
---|
This module implements a monad for SMTP sessions.
- runMailT :: (Applicative m, Monad m) => Int -> Int -> Handle -> MailT a m a -> Iteratee ByteString m a
- mailSetWriteTimeout :: Int -> MailT r m ()
- 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) => 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 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.