packages feed

smtps-gmail 1.2.0 → 1.2.1

raw patch · 2 files changed

+38/−40 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Network/Mail/Client/Gmail.hs view
@@ -1,15 +1,20 @@------------------------------------------------------------------- Copyright (c) 2014, Enzo Haussecker. All rights reserved. ------------------------------------------------------------------- {-# LANGUAGE LambdaCase        #-} {-# LANGUAGE OverloadedStrings #-} {-# OPTIONS -Wall              #-} --- | A simple SMTP Client for sending Gmail.+-- |+-- Module      : Network.Mail.Client.Gmail+-- Copyright   : Copyright (c) 2014, Enzo Haussecker. All rights reserved.+-- License     : BSD3+-- Maintainer  : Enzo Haussecker <ehaussecker@gmail.com>+-- Stability   : Experimental+-- Portability : Unknown+--+-- A simple SMTP Client for sending Gmail. module Network.Mail.Client.Gmail (sendGmail) where  import Control.Monad (foldM_, forM)+import Control.Exception (bracket) import Crypto.Random.AESCtr (makeSystem) import Data.ByteString.Char8 (lines, unpack) import Data.ByteString.Base64.Lazy (encode)@@ -53,38 +58,31 @@    -> Lazy.Text   -- ^ body    -> [FilePath]  -- ^ attachments    -> IO ()-sendGmail user pass from to cc bcc subject body attach = do-   hdl   <- connectTo "smtp.gmail.com" $ PortNumber 587-   sys   <- makeSystem-   ctx   <- contextNew hdl params sys-   _MAIL <- renderMail from to cc bcc subject body attach-   hSetBuffering hdl LineBuffering-   -----------------------------   -- BEGIN MESSAGE EXCHANGE ---   -----------------------------   sendSMTP  hdl "EHLO"       >> recvSMTP  hdl "220"-                              >> recvSMTP  hdl "250"-   sendSMTP  hdl "STARTTLS"   >> recvSMTP  hdl "220"-   handshake ctx-   sendSMTPS ctx "EHLO"       >> recvSMTPS ctx "250"-   sendSMTPS ctx "AUTH LOGIN" >> recvSMTPS ctx "334"-   sendSMTPS ctx _USERNAME    >> recvSMTPS ctx "334"-   sendSMTPS ctx _PASSWORD    >> recvSMTPS ctx "235"-   sendSMTPS ctx _FROM        >> recvSMTPS ctx "250"-   sendSMTPS ctx _TO          >> recvSMTPS ctx "250"-   sendSMTPS ctx "DATA"       >> recvSMTPS ctx "354"-   sendSMTPS ctx _MAIL        >> recvSMTPS ctx "250"-   sendSMTPS ctx "QUIT"       >> recvSMTPS ctx "221"-   -----------------------------   --- END MESSAGE EXCHANGE ----   -----------------------------   bye ctx-   contextClose ctx-   hClose hdl-   where _USERNAME  = encode $ encodeUtf8 user-         _PASSWORD  = encode $ encodeUtf8 pass-         _FROM      = "MAIL FROM: " <> angleBracket [from]-         _TO        = "RCPT TO: "   <> angleBracket (to ++ cc ++ bcc)+sendGmail user pass from to cc bcc subject body attach = +   bracket (connectTo "smtp.gmail.com" $ PortNumber 587) hClose $ \ hdl -> do+      sys   <- makeSystem+      ctx   <- contextNew hdl params sys+      _MAIL <- renderMail from to cc bcc subject body attach+      hSetBuffering hdl LineBuffering+      sendSMTP  hdl "EHLO"       >> recvSMTP  hdl "220"+                                 >> recvSMTP  hdl "250"+      sendSMTP  hdl "STARTTLS"   >> recvSMTP  hdl "220"+      handshake ctx+      sendSMTPS ctx "EHLO"       >> recvSMTPS ctx "250"+      sendSMTPS ctx "AUTH LOGIN" >> recvSMTPS ctx "334"+      sendSMTPS ctx _USERNAME    >> recvSMTPS ctx "334"+      sendSMTPS ctx _PASSWORD    >> recvSMTPS ctx "235"+      sendSMTPS ctx _FROM        >> recvSMTPS ctx "250"+      sendSMTPS ctx _TO          >> recvSMTPS ctx "250"+      sendSMTPS ctx "DATA"       >> recvSMTPS ctx "354"+      sendSMTPS ctx _MAIL        >> recvSMTPS ctx "250"+      sendSMTPS ctx "QUIT"       >> recvSMTPS ctx "221"+      bye ctx+      contextClose ctx+      where _USERNAME  = encode $ encodeUtf8 user+            _PASSWORD  = encode $ encodeUtf8 pass+            _FROM      = "MAIL FROM: " <> angleBracket [from]+            _TO        = "RCPT TO: "   <> angleBracket (to ++ cc ++ bcc)  -- | Display the first email address in the given list using angle bracket formatting. angleBracket :: [Address] -> ByteString
smtps-gmail.cabal view
@@ -1,10 +1,10 @@ Name:               smtps-gmail-Version:            1.2.0+Version:            1.2.1 License:            BSD3 License-File:       LICENSE Copyright:          Copyright (c) 2014, Enzo Haussecker. All rights reserved.-Author:             Enzo Haussecker <enzo@ucsd.edu>-Maintainer:         Enzo Haussecker <enzo@ucsd.edu>+Author:             Enzo Haussecker <ehaussecker@gmail.com>+Maintainer:         Enzo Haussecker <ehaussecker@gmail.com> Stability:          Experimental Category:           Network Synopsis:           Gmail SMTP Client