HaskellNet-SSL 0.3.4.4 → 0.4.0.0
raw patch · 4 files changed
+84/−11 lines, 4 filesdep +HaskellNet-SSLdep +crypton-connectiondep −connectiondep ~HaskellNetdep ~basedep ~bytestringnew-component:exe:HaskellNet-SSL-examplenew-uploaderPVP ok
version bump matches the API change (PVP)
Dependencies added: HaskellNet-SSL, crypton-connection
Dependencies removed: connection
Dependency ranges changed: HaskellNet, base, bytestring
API changes (from Hackage documentation)
Files
- CHANGELOG.md +8/−0
- HaskellNet-SSL.cabal +18/−6
- README.md +4/−5
- examples/gmail.hs +54/−0
+ CHANGELOG.md view
@@ -0,0 +1,8 @@+# Revision history for HaskellNet-SSL++## 0.4.0.0 -- 2025-01-07++- drop support for connection in favour of crypton-connection+- compatibility with GHCs up to ghc 9.8 (bump base and bytestring)+- fix example+- add tested-with stanza
HaskellNet-SSL.cabal view
@@ -1,19 +1,20 @@ name: HaskellNet-SSL synopsis: Helpers to connect to SSL/TLS mail servers with HaskellNet-version: 0.3.4.4+version: 0.4.0.0 description: This package ties together the HaskellNet and connection packages to make it easy to open IMAP and SMTP connections over SSL. homepage: https://github.com/dpwright/HaskellNet-SSL+tested-with: GHC ==9.4.8 || ==9.6.5 || ==9.8.2 license: BSD3 license-file: LICENSE author: Daniel P. Wright-maintainer: Leza M. Lutonda <lemol-c@outlook.com>, dani@dpwright.com+maintainer: Leza M. Lutonda <lemol-c@outlook.com>, dani@dpwright.com, contact@mangoiv.com copyright: (c) 2013 Daniel P. Wright category: Network build-type: Simple-cabal-version: >=1.10-data-files: README.md+cabal-version: 1.18+extra-doc-files: README.md, CHANGELOG.md flag network-bsd description: Get Network.BSD from the network-bsd package@@ -34,11 +35,22 @@ other-modules: Network.HaskellNet.SSL.Internal build-depends: base >= 4 && < 5, HaskellNet >= 0.3 && < 0.7,- connection >= 0.2.7 && < 0.4,- bytestring >= 0.9 && < 0.12,+ crypton-connection >= 0.3.1 && < 0.5,+ bytestring >= 0.9 && < 0.13, data-default >= 0.2 && < 0.8 if flag(network-bsd) build-depends: network >= 3.0 && < 3.2, network-bsd >= 2.7 && < 2.9 else build-depends: network >= 2.4 && < 3.0++executable HaskellNet-SSL-example+ hs-source-dirs: examples+ main-is: gmail.hs+ other-modules:+ build-depends: base,+ HaskellNet-SSL,+ HaskellNet,+ bytestring++ default-language: Haskell2010
README.md view
@@ -1,13 +1,12 @@-HaskellNet-SSL---------------+# HaskellNet-SSL -[](https://travis-ci.org/dpwright/HaskellNet-SSL)+[](https://github.com/dpwright/HaskellNet-SSL/actions/workflows/haskell.yml) This package ties together the excellent [HaskellNet][HaskellNet] and-[connection][connection] packages to make it easy to open IMAP and SMTP+[crypton-connection][crypton-connection] packages to make it easy to open IMAP and SMTP connections over SSL. This is a simple "glue" library; all credit for a) connecting to IMAP/SMTP servers and b) making an SSL connection goes to the aforementioned libraries. [HaskellNet]: https://github.com/jtdaugherty/HaskellNet-[connection]: https://github.com/vincenthz/hs-connection+[crypton-connection]: https://github.com/kazu-yamamoto/crypton-connection
+ examples/gmail.hs view
@@ -0,0 +1,54 @@+{-# LANGUAGE OverloadedStrings #-}++import Network.HaskellNet.IMAP.SSL+import Network.HaskellNet.SMTP.SSL as SMTP++import Network.HaskellNet.Auth (AuthType(LOGIN), Password)+import Network.Mail.Mime++import qualified Data.ByteString.Char8 as B+import Data.String++username :: IsString s => s+username = "username@gmail.com"++password :: Password+password = "password"++recipient :: Address+recipient = "someone@somewhere.com"++imapTest :: IO ()+imapTest = do+ c <- connectIMAPSSLWithSettings "imap.gmail.com" cfg+ login c username password+ mboxes <- list c+ mapM_ print mboxes+ select c "INBOX"+ msgs@(firstMsg : _) <- search c [ALLs]+ msgContent <- fetch c firstMsg+ B.putStrLn msgContent+ logout c+ where cfg = defaultSettingsIMAPSSL { sslMaxLineLength = 100000 }++smtpTest :: IO ()+smtpTest = doSMTPSTARTTLS "smtp.gmail.com" $ \c -> do+ authSucceed <- SMTP.authenticate LOGIN username password c+ if authSucceed+ then do + mail <- simpleMail+ recipient+ username + subject+ body+ mempty+ mempty+ sendMail mail c -- recipient username subject body+ else print "Authentication error."+ where subject = "Test message"+ body = "This is a test message"++main :: IO ()+main = do + smtpTest + imapTest