-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Client support for POP3, SMTP, and IMAP -- -- This package provides client support for the POP3, SMTP, and IMAP -- protocols. NOTE: this package will be split into smaller, -- protocol-specific packages in the future. @package HaskellNet @version 0.5 module Network.HaskellNet.Auth type UserName = String type Password = String data AuthType PLAIN :: AuthType LOGIN :: AuthType CRAM_MD5 :: AuthType b64Encode :: String -> String b64Decode :: String -> String showOctet :: [Word8] -> String hashMD5 :: [Word8] -> [Word8] hmacMD5 :: String -> String -> [Word8] plain :: UserName -> Password -> String login :: UserName -> Password -> (String, String) cramMD5 :: String -> UserName -> Password -> String auth :: AuthType -> String -> UserName -> Password -> String instance GHC.Classes.Eq Network.HaskellNet.Auth.AuthType instance GHC.Show.Show Network.HaskellNet.Auth.AuthType module Network.HaskellNet.POP3.Types data Command USER :: UserName -> Command PASS :: Password -> Command APOP :: UserName -> Password -> Command AUTH :: AuthType -> UserName -> Password -> Command NOOP :: Command QUIT :: Command STAT :: Command LIST :: (Maybe Int) -> Command DELE :: Int -> Command RETR :: Int -> Command RSET :: Command TOP :: Int -> Int -> Command UIDL :: (Maybe Int) -> Command data Response Ok :: Response Err :: Response instance GHC.Show.Show Network.HaskellNet.POP3.Types.Response instance GHC.Classes.Eq Network.HaskellNet.POP3.Types.Response module Network.HaskellNet.IMAP.Types type MailboxName = String type UID = Word64 type Charset = String data MailboxInfo MboxInfo :: MailboxName -> Integer -> Integer -> [Flag] -> [Flag] -> Bool -> Bool -> UID -> UID -> MailboxInfo [_mailbox] :: MailboxInfo -> MailboxName [_exists] :: MailboxInfo -> Integer [_recent] :: MailboxInfo -> Integer [_flags] :: MailboxInfo -> [Flag] [_permanentFlags] :: MailboxInfo -> [Flag] [_isWritable] :: MailboxInfo -> Bool [_isFlagWritable] :: MailboxInfo -> Bool [_uidNext] :: MailboxInfo -> UID [_uidValidity] :: MailboxInfo -> UID data Flag Seen :: Flag Answered :: Flag Flagged :: Flag Deleted :: Flag Draft :: Flag Recent :: Flag Keyword :: String -> Flag data Attribute Noinferiors :: Attribute Noselect :: Attribute Marked :: Attribute Unmarked :: Attribute OtherAttr :: String -> Attribute data MboxUpdate MboxUpdate :: Maybe Integer -> Maybe Integer -> MboxUpdate [exists] :: MboxUpdate -> Maybe Integer [recent] :: MboxUpdate -> Maybe Integer data StatusCode ALERT :: StatusCode BADCHARSET :: [Charset] -> StatusCode CAPABILITY_sc :: [String] -> StatusCode PARSE :: StatusCode PERMANENTFLAGS :: [Flag] -> StatusCode READ_ONLY :: StatusCode READ_WRITE :: StatusCode TRYCREATE :: StatusCode UIDNEXT_sc :: UID -> StatusCode UIDVALIDITY_sc :: UID -> StatusCode UNSEEN_sc :: Integer -> StatusCode data ServerResponse OK :: (Maybe StatusCode) -> String -> ServerResponse NO :: (Maybe StatusCode) -> String -> ServerResponse BAD :: (Maybe StatusCode) -> String -> ServerResponse PREAUTH :: (Maybe StatusCode) -> String -> ServerResponse -- | the query data type for the status command data MailboxStatus -- | the number of messages in the mailbox MESSAGES :: MailboxStatus -- | the number of messages with the Recent flag set RECENT :: MailboxStatus -- | the next unique identifier value of the mailbox UIDNEXT :: MailboxStatus -- | the unique identifier validity value of the mailbox UIDVALIDITY :: MailboxStatus data RespDerivs RespDerivs :: Result RespDerivs [Flag] -> Result RespDerivs String -> Result RespDerivs Char -> Pos -> RespDerivs [dvFlags] :: RespDerivs -> Result RespDerivs [Flag] [advTag] :: RespDerivs -> Result RespDerivs String [advChar] :: RespDerivs -> Result RespDerivs Char [advPos] :: RespDerivs -> Pos emptyMboxInfo :: MailboxInfo instance GHC.Classes.Eq Network.HaskellNet.IMAP.Types.MailboxStatus instance GHC.Read.Read Network.HaskellNet.IMAP.Types.MailboxStatus instance GHC.Show.Show Network.HaskellNet.IMAP.Types.MailboxStatus instance GHC.Show.Show Network.HaskellNet.IMAP.Types.ServerResponse instance GHC.Classes.Eq Network.HaskellNet.IMAP.Types.ServerResponse instance GHC.Show.Show Network.HaskellNet.IMAP.Types.StatusCode instance GHC.Classes.Eq Network.HaskellNet.IMAP.Types.StatusCode instance GHC.Classes.Eq Network.HaskellNet.IMAP.Types.MboxUpdate instance GHC.Show.Show Network.HaskellNet.IMAP.Types.MboxUpdate instance GHC.Classes.Eq Network.HaskellNet.IMAP.Types.Attribute instance GHC.Show.Show Network.HaskellNet.IMAP.Types.Attribute instance GHC.Classes.Eq Network.HaskellNet.IMAP.Types.MailboxInfo instance GHC.Show.Show Network.HaskellNet.IMAP.Types.MailboxInfo instance GHC.Classes.Eq Network.HaskellNet.IMAP.Types.Flag instance GHC.Show.Show Network.HaskellNet.IMAP.Types.Flag instance Text.Packrat.Parse.Derivs Network.HaskellNet.IMAP.Types.RespDerivs -- | Parsers for IMAP server responses module Network.HaskellNet.IMAP.Parsers eval :: (RespDerivs -> Result RespDerivs r) -> String -> ByteString -> r eval' :: (RespDerivs -> Result RespDerivs r) -> String -> String -> r pNone :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, ()) pCapability :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [String]) pSelect :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, MailboxInfo) pList :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [([Attribute], String, MailboxName)]) pLsub :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [([Attribute], String, MailboxName)]) pStatus :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [(MailboxStatus, Integer)]) pExpunge :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [Integer]) pSearch :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [UID]) pFetch :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [(Integer, [(String, String)])]) -- | This module provides a byte string "stream" interface. This interface -- provides some common operations on a value which supports reading and -- writing byte strings. module Network.HaskellNet.BSStream -- | A byte string stream. data BSStream BSStream :: IO ByteString -> (Int -> IO ByteString) -> (ByteString -> IO ()) -> IO () -> IO () -> IO Bool -> (Int -> IO Bool) -> BSStream -- | Read a line from the stream. Should return the line which was read, -- including the newline. [bsGetLine] :: BSStream -> IO ByteString -- | Read the specified number of bytes from the stream. Should block until -- the requested bytes can be read. [bsGet] :: BSStream -> Int -> IO ByteString -- | Write the specified byte string to the stream. Should flush the stream -- after writing. [bsPut] :: BSStream -> ByteString -> IO () -- | Flush the stream. [bsFlush] :: BSStream -> IO () -- | Close the stream. [bsClose] :: BSStream -> IO () -- | Is the stream open? [bsIsOpen] :: BSStream -> IO Bool -- | Is data available? [bsWaitForInput] :: BSStream -> Int -> IO Bool -- | Build a byte string stream which operates on a Handle. handleToStream :: Handle -> BSStream module Network.HaskellNet.IMAP.Connection data IMAPConnection withNextCommandNum :: IMAPConnection -> (Int -> IO a) -> IO (a, Int) setMailboxInfo :: IMAPConnection -> MailboxInfo -> IO () modifyMailboxInfo :: IMAPConnection -> (MailboxInfo -> MailboxInfo) -> IO () newConnection :: BSStream -> IO IMAPConnection mailbox :: IMAPConnection -> IO MailboxName exists :: IMAPConnection -> IO Integer recent :: IMAPConnection -> IO Integer flags :: IMAPConnection -> IO [Flag] permanentFlags :: IMAPConnection -> IO [Flag] isWritable :: IMAPConnection -> IO Bool isFlagWritable :: IMAPConnection -> IO Bool uidNext :: IMAPConnection -> IO UID uidValidity :: IMAPConnection -> IO UID stream :: IMAPConnection -> BSStream -- | This module provides functions for working with the SMTP protocol in -- the client side, including opening and closing -- connections, sending commands to the server, -- authenticate and sending mails. -- -- Here's a basic usage example: -- --
-- import Network.HaskellNet.SMTP -- import Network.HaskellNet.Auth -- import qualified Data.Text.Lazy as T -- -- main = doSMTP "your.smtp.server.com" $ \conn -> -- authSucceed <- authenticate PLAIN "username" "password" conn -- if authSucceed -- then sendPlainTextMail "receiver@server.com" "sender@server.com" "subject" (T.pack "Hello! This is the mail body!") conn -- else print "Authentication failed." ---- -- Notes for the above example: -- --
-- authSucceed <- authenticate PLAIN "username" "password" conn -- if authSucceed -- then sendPlainTextMail "receiver@server.com" "sender@server.com" "subject" (T.pack "Hello!") conn -- else print "Authentication failed." --authenticate :: AuthType -> UserName -> Password -> SMTPConnection -> IO Bool -- | sending a mail to a server. This is achieved by sendMessage. If -- something is wrong, it raises an IOexception. sendMail :: String -> [String] -> ByteString -> SMTPConnection -> IO () -- | doSMTPPort open a connection, and do an IO action with the connection, -- and then close it. doSMTPPort :: String -> PortNumber -> (SMTPConnection -> IO a) -> IO a -- | doSMTP is similar to doSMTPPort, except that it does not require port -- number but connects to the server with port 25. doSMTP :: String -> (SMTPConnection -> IO a) -> IO a -- | doSMTPStream is similar to doSMTPPort, except that its argument is a -- Stream data instead of hostname and port number. doSMTPStream :: BSStream -> (SMTPConnection -> IO a) -> IO a -- | Send a plain text mail. sendPlainTextMail :: String -> String -> String -> Text -> SMTPConnection -> IO () -- | Send a mime mail. The attachments are included with the file path. sendMimeMail :: String -> String -> String -> Text -> Text -> [(Text, FilePath)] -> SMTPConnection -> IO () -- | Send a mime mail. The attachments are included with in-memory -- ByteString. sendMimeMail' :: String -> String -> String -> Text -> Text -> [(Text, Text, ByteString)] -> SMTPConnection -> IO () sendMimeMail2 :: Mail -> SMTPConnection -> IO () instance GHC.Classes.Eq Network.HaskellNet.SMTP.Response instance GHC.Show.Show Network.HaskellNet.SMTP.Response instance GHC.Classes.Eq Network.HaskellNet.SMTP.Command instance GHC.Show.Show Network.HaskellNet.SMTP.Command module Network.HaskellNet.POP3.Connection data POP3Connection stream :: POP3Connection -> BSStream newConnection :: BSStream -> String -> POP3Connection -- | APOP key apopKey :: POP3Connection -> String module Network.HaskellNet.POP3 -- | connecting to the pop3 server specified by the hostname and port -- number connectPop3Port :: String -> PortNumber -> IO POP3Connection -- | connecting to the pop3 server specified by the hostname. 110 is used -- for the port number. connectPop3 :: String -> IO POP3Connection -- | connecting to the pop3 server via a stream connectStream :: BSStream -> IO POP3Connection -- | sendCommand sends a pop3 command via a pop3 connection. This action is -- too generic. Use more specific actions sendCommand :: POP3Connection -> Command -> IO (Response, ByteString) closePop3 :: POP3Connection -> IO () user :: POP3Connection -> String -> IO () pass :: POP3Connection -> String -> IO () userPass :: POP3Connection -> UserName -> Password -> IO () apop :: POP3Connection -> String -> String -> IO () auth :: POP3Connection -> AuthType -> UserName -> Password -> IO () stat :: POP3Connection -> IO (Int, Int) dele :: POP3Connection -> Int -> IO () retr :: POP3Connection -> Int -> IO ByteString top :: POP3Connection -> Int -> Int -> IO ByteString rset :: POP3Connection -> IO () allList :: POP3Connection -> IO [(Int, Int)] list :: POP3Connection -> Int -> IO Int allUIDLs :: POP3Connection -> IO [(Int, ByteString)] uidl :: POP3Connection -> Int -> IO ByteString doPop3Port :: String -> PortNumber -> (POP3Connection -> IO a) -> IO a doPop3 :: String -> (POP3Connection -> IO a) -> IO a doPop3Stream :: BSStream -> (POP3Connection -> IO b) -> IO b data AuthType PLAIN :: AuthType LOGIN :: AuthType CRAM_MD5 :: AuthType module Network.HaskellNet.Debug debugStream :: BSStream -> BSStream module Network.HaskellNet.IMAP connectIMAP :: String -> IO IMAPConnection connectIMAPPort :: String -> PortNumber -> IO IMAPConnection connectStream :: BSStream -> IO IMAPConnection noop :: IMAPConnection -> IO () capability :: IMAPConnection -> IO [String] logout :: IMAPConnection -> IO () login :: IMAPConnection -> UserName -> Password -> IO () authenticate :: IMAPConnection -> AuthType -> UserName -> Password -> IO () select :: IMAPConnection -> MailboxName -> IO () examine :: IMAPConnection -> MailboxName -> IO () create :: IMAPConnection -> MailboxName -> IO () delete :: IMAPConnection -> MailboxName -> IO () rename :: IMAPConnection -> MailboxName -> MailboxName -> IO () subscribe :: IMAPConnection -> MailboxName -> IO () unsubscribe :: IMAPConnection -> MailboxName -> IO () list :: IMAPConnection -> IO [([Attribute], MailboxName)] lsub :: IMAPConnection -> IO [([Attribute], MailboxName)] status :: IMAPConnection -> MailboxName -> [MailboxStatus] -> IO [(MailboxStatus, Integer)] append :: IMAPConnection -> MailboxName -> ByteString -> IO () check :: IMAPConnection -> IO () close :: IMAPConnection -> IO () expunge :: IMAPConnection -> IO [Integer] search :: IMAPConnection -> [SearchQuery] -> IO [UID] store :: IMAPConnection -> UID -> FlagsQuery -> IO () copy :: IMAPConnection -> UID -> MailboxName -> IO () idle :: IMAPConnection -> Int -> IO () fetch :: IMAPConnection -> UID -> IO ByteString fetchHeader :: IMAPConnection -> UID -> IO ByteString fetchSize :: IMAPConnection -> UID -> IO Int fetchHeaderFields :: IMAPConnection -> UID -> [String] -> IO ByteString fetchHeaderFieldsNot :: IMAPConnection -> UID -> [String] -> IO ByteString fetchFlags :: IMAPConnection -> UID -> IO [Flag] fetchR :: IMAPConnection -> (UID, UID) -> IO [(UID, ByteString)] fetchByString :: IMAPConnection -> UID -> String -> IO [(String, String)] fetchByStringR :: IMAPConnection -> (UID, UID) -> String -> IO [(UID, [(String, String)])] data Flag Seen :: Flag Answered :: Flag Flagged :: Flag Deleted :: Flag Draft :: Flag Recent :: Flag Keyword :: String -> Flag data Attribute Noinferiors :: Attribute Noselect :: Attribute Marked :: Attribute Unmarked :: Attribute OtherAttr :: String -> Attribute -- | the query data type for the status command data MailboxStatus -- | the number of messages in the mailbox MESSAGES :: MailboxStatus -- | the number of messages with the Recent flag set RECENT :: MailboxStatus -- | the next unique identifier value of the mailbox UIDNEXT :: MailboxStatus -- | the unique identifier validity value of the mailbox UIDVALIDITY :: MailboxStatus data SearchQuery ALLs :: SearchQuery FLAG :: Flag -> SearchQuery UNFLAG :: Flag -> SearchQuery BCCs :: String -> SearchQuery BEFOREs :: CalendarTime -> SearchQuery BODYs :: String -> SearchQuery CCs :: String -> SearchQuery FROMs :: String -> SearchQuery HEADERs :: String -> String -> SearchQuery LARGERs :: Integer -> SearchQuery NEWs :: SearchQuery NOTs :: SearchQuery -> SearchQuery OLDs :: SearchQuery ONs :: CalendarTime -> SearchQuery ORs :: SearchQuery -> SearchQuery -> SearchQuery SENTBEFOREs :: CalendarTime -> SearchQuery SENTONs :: CalendarTime -> SearchQuery SENTSINCEs :: CalendarTime -> SearchQuery SINCEs :: CalendarTime -> SearchQuery SMALLERs :: Integer -> SearchQuery SUBJECTs :: String -> SearchQuery TEXTs :: String -> SearchQuery TOs :: String -> SearchQuery UIDs :: [UID] -> SearchQuery data FlagsQuery ReplaceFlags :: [Flag] -> FlagsQuery PlusFlags :: [Flag] -> FlagsQuery MinusFlags :: [Flag] -> FlagsQuery data AuthType PLAIN :: AuthType LOGIN :: AuthType CRAM_MD5 :: AuthType instance GHC.Show.Show Network.HaskellNet.IMAP.SearchQuery