| Stability | experimental |
|---|---|
| Maintainer | Ertugrul Soeylemez <es@ertes.de> |
Network.Smtp
Contents
Description
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 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 and
responseLines. 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).
- module Network.Smtp.Connect
- module Network.Smtp.Monad
- module Network.Smtp.Session
- module Network.Smtp.Simple
- module Network.Smtp.Tools
- module Network.Smtp.Types
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