ismtp-3.0.1: Network/Smtp.hs
-- |
-- Module: Network.SMTP
-- Copyright: (c) 2011 Ertugrul Soeylemez
-- License: BSD3
-- Maintainer: Ertugrul Soeylemez <es@ertes.de>
--
-- This package provides a monad transformer for fast, incremental ESMTP
-- sessions, with which you can, among other things, send emails. Here
-- is an example session:
--
-- > import Network.Smtp
-- >
-- > mailSession ::
-- > MonadIO m =>
-- > ByteString -> ByteString -> ByteString -> ByteString -> MailT r m ()
-- > mailSession srcDomain fromAddr toAddr content = do
-- > waitForWelcome
-- > hello srcDomain
-- > mailFrom fromAddr
-- > rcptTo toAddr
-- > mailDataStr content
-- > quit
--
-- The @r@ type parameter is related to contstuff's 'StateT' monad
-- transformer, which is used internally. If you don't know what to do,
-- just leave it fully polymorphic like in the example above. You only
-- need to care about @r@, if you want to make use of the CPS features
-- of 'StateT'.
--
-- The simplest interfaces to running SMTP sessions are 'withSmtpConn'
-- and 'withMxConn'. The latter does a DNS lookup for the given domain
-- to discover the MX server and connect to it. The former simply
-- connects to the given hostname and port.
--
-- If you need more control over the connection handles and other
-- parameters like timeout and flood protection, you may want to use
-- 'sendMail' or 'sendMail_' instead. Those functions are also useful,
-- if you want to run an SMTP session using stdin and stdout for testing
-- and other purposes.
--
-- Finally you can use the low level interface for running sessions.
-- See the 'runMailT' function along with 'enumHandleTimeout'. This way
-- you get the full power of iteratees. For example you can run the
-- session through a custom enumeratee, which enables you to wrap the
-- session in another protocol (e.g. proxy servers or SSL). This is not
-- possible with the higher level functions.
module Network.Smtp
( -- * Reexports
module Network.Smtp.Connect,
module Network.Smtp.Monad,
module Network.Smtp.Session,
module Network.Smtp.Simple,
module Network.Smtp.Tools,
module Network.Smtp.Types
)
where
import Network.Smtp.Connect
import Network.Smtp.Monad
import Network.Smtp.Session
import Network.Smtp.Simple
import Network.Smtp.Tools
import Network.Smtp.Types