Stability | experimental |
---|---|
Maintainer | Ertugrul Soeylemez <es@ertes.de> |
High level interfaces for networking.
- withMxConn :: (Applicative m, DnsMonad m, MonadPeelIO m) => Domain -> Bool -> MailT (Either SomeException a) m a -> m a
- withSmtpConn :: forall a m. (Applicative m, MonadPeelIO m) => HostName -> PortID -> MailT (Either SomeException a) m a -> m a
- withIsmtp :: IO a -> IO a
- ignoreSigPipe :: IO ()
- withIgnoredSigPipe :: IO a -> IO a
Connection
withMxConn :: (Applicative m, DnsMonad m, MonadPeelIO m) => Domain -> Bool -> MailT (Either SomeException a) m a -> m aSource
Interface to withSmtpConn
, which connects to the first mail
exchanger (MX) of the given domain on port 25. The Bool
parameter
specifies whether to fall back to the given domain itself, if no MX
records can be found.
withSmtpConn :: forall a m. (Applicative m, MonadPeelIO m) => HostName -> PortID -> MailT (Either SomeException a) m a -> m aSource
Connect to the specified SMTP server and run the given computation.
Note that there is also withMxConn
, which resolves the MX server of
the given domain.
Initialization
withIsmtp :: IO a -> IO aSource
Perform some useful (but not necessarily needed) initialization like disabling SIGPIPE and initializing sockets, run the given computation and then clean up.
Utility functions
Disable the SIGPIPE signal, so our program doesn't die on broken pipes.
withIgnoredSigPipe :: IO a -> IO aSource
Run the given computation with the SIGPIPE signal disabled, so our program doesn't die on broken pipes.