Safe Haskell | None |
---|
- data Command
- data Response
- = Ok
- | SystemStatus
- | HelpMessage
- | ServiceReady
- | ServiceClosing
- | UserNotLocal
- | CannotVerify
- | StartMailInput
- | ServiceNotAvailable
- | MailboxUnavailable
- | ErrorInProcessing
- | InsufficientSystemStorage
- | SyntaxError
- | ParameterError
- | CommandNotImplemented
- | BadSequence
- | ParameterNotImplemented
- | MailboxUnavailableError
- | UserNotLocalError
- | ExceededStorage
- | MailboxNotAllowed
- | TransactionFailed
- data SMTPConnection
- connectSMTPPort :: String -> PortNumber -> IO SMTPConnection
- connectSMTP :: String -> IO SMTPConnection
- connectStream :: BSStream -> IO SMTPConnection
- sendCommand :: SMTPConnection -> Command -> IO (ReplyCode, ByteString)
- closeSMTP :: SMTPConnection -> IO ()
- sendMail :: String -> [String] -> ByteString -> SMTPConnection -> IO ()
- doSMTPPort :: String -> PortNumber -> (SMTPConnection -> IO a) -> IO a
- doSMTP :: String -> (SMTPConnection -> IO a) -> IO a
- doSMTPStream :: BSStream -> (SMTPConnection -> IO a) -> IO a
- sendMimeMail :: String -> String -> String -> Text -> Text -> [(Text, FilePath)] -> SMTPConnection -> IO ()
Types
data SMTPConnection Source
Establishing Connection
:: String | name of the server |
-> PortNumber | port number |
-> IO SMTPConnection |
connecting SMTP server with the specified name and port number.
:: String | name of the server |
-> IO SMTPConnection |
connecting SMTP server with the specified name and port 25.
connectStream :: BSStream -> IO SMTPConnectionSource
create SMTPConnection from already connected Stream
Operation to a Connection
sendCommand :: SMTPConnection -> Command -> IO (ReplyCode, ByteString)Source
send a method to a server
closeSMTP :: SMTPConnection -> IO ()Source
close the connection. This function send the QUIT method, so you do not have to QUIT method explicitly.
Other Useful Operations
:: String | sender mail |
-> [String] | receivers |
-> ByteString | data |
-> SMTPConnection | |
-> IO () |
sending a mail to a server. This is achieved by sendMessage. If something is wrong, it raises an IOexception.
doSMTPPort :: String -> PortNumber -> (SMTPConnection -> IO a) -> IO aSource
doSMTPPort open a connection, and do an IO action with the connection, and then close it.
doSMTP :: String -> (SMTPConnection -> IO a) -> IO aSource
doSMTP is similar to doSMTPPort, except that it does not require port number but connects to the server with port 25.
doSMTPStream :: BSStream -> (SMTPConnection -> IO a) -> IO aSource
doSMTPStream is similar to doSMTPPort, except that its argument is a Stream data instead of hostname and port number.