Network.Mail.Mime: exported symbols usage examples

Symbols

  • addAttachment No usage example found for this symbol :( Collapse [-]
    addAttachmentBS No usage example found for this symbol :( Collapse [-]
    addAttachmentBSCid No usage example found for this symbol :( Collapse [-]
    addAttachmentCid No usage example found for this symbol :( Collapse [-]
    addAttachments No usage example found for this symbol :( Collapse [-]
    addAttachmentsBS No usage example found for this symbol :( Collapse [-]
    addPart No usage example found for this symbol :( Collapse [-]
    emptyMail No usage example found for this symbol :( Collapse [-]
    htmlPart See 4 Occurences [+] Collapse [-]
    Found in Network.Mail.SMTP from the package smtp-mail
             , mailTo   = to
             , mailCc   = cc
             , mailBcc  = bcc
             , mailHeaders = [ ("Subject", subject) ]
             , mailParts = [parts]
             }
    
    -- | Construct a plain text 'Part'
    plainTextPart :: TL.Text -> Part
    plainTextPart = Part "text/plain; charset=utf-8"
                  QuotedPrintableText Nothing [] . TL.encodeUtf8
    
    -- | Construct an html 'Part'
    htmlPart :: TL.Text -> Part
    htmlPart = Part "text/html; charset=utf-8"
                 QuotedPrintableText Nothing [] . TL.encodeUtf8
    
    -- | Construct a file attachment 'Part'
    filePart :: T.Text -- ^ content type
             -> FilePath -- ^ path to file
    

    Found in Network.Mail.SMTP from the package smtp-mail
        Mail { mailFrom = from
             , mailTo   = to
             , mailCc   = cc
             , mailBcc  = bcc
             , mailHeaders = [ ("Subject", subject) ]
             , mailParts = [parts]
             }
    
    -- | Construct a plain text 'Part'
    plainTextPart :: TL.Text -> Part
    plainTextPart = Part "text/plain; charset=utf-8"
                  QuotedPrintableText Nothing [] . TL.encodeUtf8
    
    -- | Construct an html 'Part'
    htmlPart :: TL.Text -> Part
    htmlPart = Part "text/html; charset=utf-8"
                 QuotedPrintableText Nothing [] . TL.encodeUtf8
    
    -- | Construct a file attachment 'Part'
    filePart :: T.Text -- ^ content type
    

    Found in Network.Mail.SMTP from the package smtp-mail
        where
    
    import Network.Mail.SMTP.Auth
    import Network.Mail.SMTP.Types
    
    import System.IO
    import System.FilePath (takeFileName)
    
    import Control.Monad (unless)
    import Data.Monoid
    import Data.Char (isDigit)
    
    import Network
    import Network.BSD (getHostName)
    import Network.Mail.Mime hiding (htmlPart, simpleMail)
    
    import Data.ByteString (ByteString)
    import qualified Data.ByteString as B
    import qualified Data.ByteString.Char8 as B8
    import qualified Data.ByteString.Lazy as BL
    

    Found in Network.Mail.SMTP from the package smtp-mail
    {-# LANGUAGE OverloadedStrings, RecordWildCards, ScopedTypeVariables #-}
    
    module Network.Mail.SMTP
        ( -- * Main interface
          sendMail
        , sendMail'
        , sendMailWithLogin
        , sendMailWithLogin'
        , sendMailWithSender
        , sendMailWithSender'
        , simpleMail
        , plainTextPart
        , htmlPart
        , filePart
    
        -- * Types
        , module Network.Mail.SMTP.Types
        , SMTPConnection
    

    plainPart No usage example found for this symbol :( Collapse [-]
    quotedPrintable No usage example found for this symbol :( Collapse [-]
    randomString No usage example found for this symbol :( Collapse [-]
    renderAddress No usage example found for this symbol :( Collapse [-]
    renderMail No usage example found for this symbol :( Collapse [-]
    renderMail' See 5 Occurences [+] Collapse [-]
    Found in Network.HaskellNet.SMTP from the package HaskellNet
                  -> IO ()
    sendMimeMail' to from subject plainBody htmlBody attachments con = do
      let myMail = simpleMailInMemory (address to) (address from) (T.pack subject)
                                      plainBody htmlBody attachments
      sendMimeMail2 myMail con
      where
        address = Address Nothing . T.pack
    
    sendMimeMail2 :: Mail -> SMTPConnection -> IO ()
    sendMimeMail2 mail con = do
        let (Address _ from) = mailFrom mail
            recps = map (T.unpack . addressEmail)
                         $ (mailTo mail ++ mailCc mail ++ mailBcc mail)
        when (null recps) $ fail "no receiver specified."
        renderedMail <- renderMail' $ mail { mailBcc = [] }
        sendMail (T.unpack from) recps (lazyToStrict renderedMail) con
    
    -- haskellNet uses strict bytestrings
    -- TODO: look at making haskellnet lazy
    lazyToStrict :: B.ByteString -> S.ByteString
    

    Found in Network.HaskellNet.SMTP from the package HaskellNet
            address = Address Nothing . T.pack
    
    -- | Send a mime mail. The attachments are included with the file path.
    sendMimeMail :: String               -- ^ receiver
                 -> String               -- ^ sender
                 -> String               -- ^ subject
                 -> LT.Text              -- ^ plain text body
                 -> LT.Text              -- ^ html body
                 -> [(T.Text, FilePath)] -- ^ attachments: [(content_type, path)]
                 -> SMTPConnection
                 -> IO ()
    sendMimeMail to from subject plainBody htmlBody attachments con = do
      myMail <- simpleMail (address to) (address from) (T.pack subject)
                plainBody htmlBody attachments
      renderedMail <- renderMail' myMail
      sendMail from [to] (lazyToStrict renderedMail) con
      where
        address = Address Nothing . T.pack
    
    -- | Send a mime mail. The attachments are included with in-memory 'ByteString'.
    

    Found in Network.HaskellNet.SMTP from the package HaskellNet
    -- | 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
    doSMTPStream s = bracket (connectStream s) closeSMTP
    
    -- | Send a plain text mail.
    sendPlainTextMail :: String  -- ^ receiver
                      -> String  -- ^ sender
                      -> String  -- ^ subject
                      -> LT.Text -- ^ body
                      -> SMTPConnection -- ^ the connection
                      -> IO ()
    sendPlainTextMail to from subject body con = do
        renderedMail <- renderMail' myMail
        sendMail from [to] (lazyToStrict renderedMail) con
        where
            myMail = simpleMail' (address to) (address from) (T.pack subject) body
            address = Address Nothing . T.pack
    

    Found in Network.Mail.SMTP from the package smtp-mail
    sendMailWithSender sender host mail = do
        con <- connectSMTP host
        renderAndSendFrom sender con mail
        closeSMTP con
    
    -- | Send a 'Mail' with a given sender.
    sendMailWithSender' :: ByteString -> HostName -> PortNumber -> Mail -> IO ()
    sendMailWithSender' sender host port mail = do
        con <- connectSMTP' host port
        renderAndSendFrom sender con mail
        closeSMTP con
    
    renderAndSendFrom :: ByteString -> SMTPConnection -> Mail -> IO ()
    renderAndSendFrom sender conn mail@Mail{..} = do
        rendered <- BL.toStrict `fmap` renderMail' mail
        sendRenderedMail sender to rendered conn
      where enc  = encodeUtf8 . addressEmail
            to   = map enc mailTo
    
    -- | A convenience function that sends 'AUTH' 'LOGIN' to the server
    

    Found in Network.Mail.SMTP from the package smtp-mail
                -> [ByteString] -- ^ receivers
                -> ByteString   -- ^ data
                -> SMTPConnection
                -> IO ()
    sendRenderedMail sender receivers dat conn = do
        _ <- tryOnce conn (MAIL sender) 250
        mapM_ (\r -> tryOnce conn (RCPT r) 250) receivers
        _ <- tryOnce conn (DATA dat) 250
        return ()
    
    -- | Render a 'Mail' to a 'ByteString' then send it over the specified
    -- 'SMTPConnection'
    renderAndSend ::SMTPConnection -> Mail -> IO ()
    renderAndSend conn mail@Mail{..} = do
        rendered <- lazyToStrict `fmap` renderMail' mail
        sendRenderedMail from to rendered conn
      where enc  = encodeUtf8 . addressEmail
            from = enc mailFrom
            to   = map enc mailTo
    

    renderSendMail See 1 Occurences [+] Collapse [-]
    Found in Network.Mail.SMTP from the package smtp-mail
        , sendMailWithSender
        , sendMailWithSender'
        , simpleMail
        , plainTextPart
        , htmlPart
        , filePart
    
        -- * Types
        , module Network.Mail.SMTP.Types
        , SMTPConnection
    
          -- * Network.Mail.Mime's sendmail interface (reexports)
        , sendmail
        , sendmailCustom
        , renderSendMail
        , renderSendMailCustom
    
          -- * Establishing Connection
        , connectSMTP
        , connectSMTP'
    

    renderSendMailCustom See 1 Occurences [+] Collapse [-]
    Found in Network.Mail.SMTP from the package smtp-mail
        , sendMailWithSender'
        , simpleMail
        , plainTextPart
        , htmlPart
        , filePart
    
        -- * Types
        , module Network.Mail.SMTP.Types
        , SMTPConnection
    
          -- * Network.Mail.Mime's sendmail interface (reexports)
        , sendmail
        , sendmailCustom
        , renderSendMail
        , renderSendMailCustom
    
          -- * Establishing Connection
        , connectSMTP
        , connectSMTP'
        , connectSMTPWithHostName
    

    sendmail See 1 Occurences [+] Collapse [-]
    Found in Network.Mail.SMTP from the package smtp-mail
        , sendMailWithLogin
        , sendMailWithLogin'
        , sendMailWithSender
        , sendMailWithSender'
        , simpleMail
        , plainTextPart
        , htmlPart
        , filePart
    
        -- * Types
        , module Network.Mail.SMTP.Types
        , SMTPConnection
    
          -- * Network.Mail.Mime's sendmail interface (reexports)
        , sendmail
        , sendmailCustom
        , renderSendMail
        , renderSendMailCustom
    
          -- * Establishing Connection
    

    sendmailCustom See 1 Occurences [+] Collapse [-]
    Found in Network.Mail.SMTP from the package smtp-mail
        , sendMailWithLogin'
        , sendMailWithSender
        , sendMailWithSender'
        , simpleMail
        , plainTextPart
        , htmlPart
        , filePart
    
        -- * Types
        , module Network.Mail.SMTP.Types
        , SMTPConnection
    
          -- * Network.Mail.Mime's sendmail interface (reexports)
        , sendmail
        , sendmailCustom
        , renderSendMail
        , renderSendMailCustom
    
          -- * Establishing Connection
        , connectSMTP
    

    sendmailCustomCaptureOutput No usage example found for this symbol :( Collapse [-]
    simpleMail See 5 Occurences [+] Collapse [-]
    Found in Network.HaskellNet.SMTP from the package HaskellNet
        where
            myMail = simpleMail' (address to) (address from) (T.pack subject) body
            address = Address Nothing . T.pack
    
    -- | Send a mime mail. The attachments are included with the file path.
    sendMimeMail :: String               -- ^ receiver
                 -> String               -- ^ sender
                 -> String               -- ^ subject
                 -> LT.Text              -- ^ plain text body
                 -> LT.Text              -- ^ html body
                 -> [(T.Text, FilePath)] -- ^ attachments: [(content_type, path)]
                 -> SMTPConnection
                 -> IO ()
    sendMimeMail to from subject plainBody htmlBody attachments con = do
      myMail <- simpleMail (address to) (address from) (T.pack subject)
                plainBody htmlBody attachments
      renderedMail <- renderMail' myMail
      sendMail from [to] (lazyToStrict renderedMail) con
      where
        address = Address Nothing . T.pack
    

    Found in Network.Mail.SMTP from the package smtp-mail
    -- | A convenience function that sends 'AUTH' 'LOGIN' to the server
    login :: SMTPConnection -> UserName -> Password -> IO (ReplyCode, ByteString)
    login con user pass = sendCommand con (AUTH LOGIN user pass)
    
    -- | A simple interface for generating a 'Mail' with a plantext body and
    -- an optional HTML body.
    simpleMail :: Address   -- ^ from
               -> [Address] -- ^ to
               -> [Address] -- ^ CC
               -> [Address] -- ^ BCC
               -> T.Text -- ^ subject
               -> [Part] -- ^ list of parts (list your preferred part last)
               -> Mail
    simpleMail from to cc bcc subject parts =
        Mail { mailFrom = from
             , mailTo   = to
             , mailCc   = cc
             , mailBcc  = bcc
             , mailHeaders = [ ("Subject", subject) ]
    

    Found in Network.Mail.SMTP from the package smtp-mail
    renderAndSendFrom :: ByteString -> SMTPConnection -> Mail -> IO ()
    renderAndSendFrom sender conn mail@Mail{..} = do
        rendered <- BL.toStrict `fmap` renderMail' mail
        sendRenderedMail sender to rendered conn
      where enc  = encodeUtf8 . addressEmail
            to   = map enc mailTo
    
    -- | A convenience function that sends 'AUTH' 'LOGIN' to the server
    login :: SMTPConnection -> UserName -> Password -> IO (ReplyCode, ByteString)
    login con user pass = sendCommand con (AUTH LOGIN user pass)
    
    -- | A simple interface for generating a 'Mail' with a plantext body and
    -- an optional HTML body.
    simpleMail :: Address   -- ^ from
               -> [Address] -- ^ to
               -> [Address] -- ^ CC
               -> [Address] -- ^ BCC
               -> T.Text -- ^ subject
               -> [Part] -- ^ list of parts (list your preferred part last)
    

    Found in Network.Mail.SMTP from the package smtp-mail
        where
    
    import Network.Mail.SMTP.Auth
    import Network.Mail.SMTP.Types
    
    import System.IO
    import System.FilePath (takeFileName)
    
    import Control.Monad (unless)
    import Data.Monoid
    import Data.Char (isDigit)
    
    import Network
    import Network.BSD (getHostName)
    import Network.Mail.Mime hiding (htmlPart, simpleMail)
    
    import Data.ByteString (ByteString)
    import qualified Data.ByteString as B
    import qualified Data.ByteString.Char8 as B8
    import qualified Data.ByteString.Lazy as BL
    

    Found in Network.Mail.SMTP from the package smtp-mail
    {-# LANGUAGE OverloadedStrings, RecordWildCards, ScopedTypeVariables #-}
    
    module Network.Mail.SMTP
        ( -- * Main interface
          sendMail
        , sendMail'
        , sendMailWithLogin
        , sendMailWithLogin'
        , sendMailWithSender
        , sendMailWithSender'
        , simpleMail
        , plainTextPart
        , htmlPart
        , filePart
    
        -- * Types
    

    simpleMail' See 1 Occurences [+] Collapse [-]
    Found in Network.HaskellNet.SMTP from the package HaskellNet
    doSMTPStream :: BSStream -> (SMTPConnection -> IO a) -> IO a
    doSMTPStream s = bracket (connectStream s) closeSMTP
    
    -- | Send a plain text mail.
    sendPlainTextMail :: String  -- ^ receiver
                      -> String  -- ^ sender
                      -> String  -- ^ subject
                      -> LT.Text -- ^ body
                      -> SMTPConnection -- ^ the connection
                      -> IO ()
    sendPlainTextMail to from subject body con = do
        renderedMail <- renderMail' myMail
        sendMail from [to] (lazyToStrict renderedMail) con
        where
            myMail = simpleMail' (address to) (address from) (T.pack subject) body
            address = Address Nothing . T.pack
    
    -- | Send a mime mail. The attachments are included with the file path.
    sendMimeMail :: String               -- ^ receiver
                 -> String               -- ^ sender
    

    simpleMailInMemory See 1 Occurences [+] Collapse [-]
    Found in Network.HaskellNet.SMTP from the package HaskellNet
      sendMail from [to] (lazyToStrict renderedMail) con
      where
        address = Address Nothing . T.pack
    
    -- | Send a mime mail. The attachments are included with in-memory 'ByteString'.
    sendMimeMail' :: String                         -- ^ receiver
                  -> String                         -- ^ sender
                  -> String                         -- ^ subject
                  -> LT.Text                        -- ^ plain text body
                  -> LT.Text                        -- ^ html body
                  -> [(T.Text, T.Text, B.ByteString)] -- ^ attachments: [(content_type, file_name, content)]
                  -> SMTPConnection
                  -> IO ()
    sendMimeMail' to from subject plainBody htmlBody attachments con = do
      let myMail = simpleMailInMemory (address to) (address from) (T.pack subject)
                                      plainBody htmlBody attachments
      sendMimeMail2 myMail con
      where
        address = Address Nothing . T.pack
    

    Address No usage example found for this symbol :( Collapse [-]
    Alternatives No usage example found for this symbol :( Collapse [-]
    Boundary No usage example found for this symbol :( Collapse [-]
    Encoding No usage example found for this symbol :( Collapse [-]
    Headers No usage example found for this symbol :( Collapse [-]
    Mail No usage example found for this symbol :( Collapse [-]
    Part No usage example found for this symbol :( Collapse [-]