-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Fast, incremental ESMTP sessions -- -- This library provides fast, incremental SMTP sessions, so you can -- control each aspect of the session. It uses iteratees and -- blaze-builder for fast I/O. @package ismtp @version 1.0.2 -- | This module implements the low level SMTP protocol implementation. module Network.Smtp.Protocol -- | SMTP service extension. data Extension -- | The Mail monad transformer encapsulates an SMTP session. type Mail a = StateT MailConfig (Iteratee ByteString IO) a -- | Mail session configuration. data MailConfig MailConfig :: Set Extension -> Handle -> MailConfig mailExtensions :: MailConfig -> Set Extension mailHandle :: MailConfig -> Handle -- | Run a Mail computation with the given session timeout in -- microseconds. runMail :: Int -> MailConfig -> Mail a -> IO a -- | Send mail via MX. sendMail :: DnsMonad m => Int -> Domain -> Mail a -> m a -- | Send mail directly to a host. sendMailDirect :: Int -> Address -> Mail a -> IO a -- | Wait for 220 greeting. waitForWelcome :: Mail () -- | Try *EHLO* with fallback to *HELO*. sendHello :: ByteString -> Mail () -- | Send *MAIL FROM* command. sendMailFrom :: ByteString -> Mail () -- | Send *RCPT TO* command. By specification this command can be issued -- multiple times. sendRcptTo :: ByteString -> Mail () -- | Send *DATA* command followed by the actual mail content. sendData :: Builder -> Mail () -- | Send *RSET* command to abort the current SMTP transaction. sendReset :: Mail () -- | Send *QUIT* command to finish the SMTP session. sendQuit :: Mail () -- | Read SMTP code. codeParser :: ByteString -> Parser [ByteString] -- | Send a command to the SMTP peer. mailPut :: Builder -> Mail () -- | Send a list of strings to the SMTP peer. mailPutList :: [ByteString] -> Mail () instance Eq Extension instance Ord Extension -- | This package provides a monad for fast, incremental ESMTP sessions, -- with which you can, among other things, send emails. Here is an -- example session: -- --
-- mailSession :: ByteString -> ByteString -> ByteString -> -- Builder -> Mail () -- mailSession srcDomain fromAddr toAddr content = do -- waitForWelcome -- sendHello srcDomain -- sendMailFrom fromAddr -- sendRcptTo toAddr -- sendData content -- sendQuit ---- -- You can use the sendMail function to send a mail via a domain's -- MX server, which is looked up via DNS. Alternatively you can connect -- to a specific SMTP server directly by using the sendMailDirect -- function. Finally for a low-level interface you can use the -- runMail function. module Network.Smtp