packages feed

mime-mail 0.3.0 → 0.3.0.1

raw patch · 2 files changed

+15/−4 lines, 2 files

Files

Network/Mail/Mime.hs view
@@ -29,7 +29,7 @@ import System.Process import System.IO import System.Exit-import Codec.Binary.Base64 (encode)+import qualified Codec.Binary.Base64 as Base64 import Control.Monad ((<=<), forM) import Data.List (intersperse) import qualified Data.Text.Lazy as LT@@ -120,8 +120,7 @@     builder =         case encoding of             None -> fromWriteList writeByteString $ L.toChunks content-            Base64 -> fromWriteList writeWord8 $ map (toEnum . fromEnum)-                    $ encode $ L.unpack content+            Base64 -> base64 content             QuotedPrintableText -> quotedPrintable True content             QuotedPrintableBinary -> quotedPrintable False content @@ -306,3 +305,15 @@         | otherwise = go'' w     go'' w = fromWord8 61 `mappend` hex (w `shiftR` 4)                           `mappend` hex (w .&. 15)++-- Encode data into base64. Base64.encode cannot be used here+-- because it suffers from stack overflow when used with larget input.+base64 :: L.ByteString -> Builder+base64 = go Base64.encodeInc . groupN 10 . L.unpack+    where+        go encoder [] = case encoder Base64.EDone of+            Base64.EFinal str -> fromChar8String str+        go encoder (chunk:rest) = case encoder $ Base64.EChunk chunk of+            Base64.EPart str next -> fromChar8String str `mappend` go next rest+        fromChar8String = fromWriteList writeWord8 . map (toEnum . fromEnum)+        groupN n = map (take n) . takeWhile (not . null) . iterate (drop n)
mime-mail.cabal view
@@ -1,5 +1,5 @@ Name:                mime-mail-Version:             0.3.0+Version:             0.3.0.1 Synopsis:            Compose MIME email messages. Description:         This package provides some high-level datatypes for declaring MIME email messages, functions for automatically composing these into bytestrings, and the ability to send bytestrings via the sendmail executable. You can also use any other library you wish to send via different methods, eg directly to SMTP. Homepage:            http://github.com/snoyberg/mime-mail