mime-mail 0.4.6.2 → 0.4.7
raw patch · 3 files changed
+41/−1 lines, 3 files
Files
- ChangeLog.md +4/−0
- Network/Mail/Mime.hs +36/−0
- mime-mail.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.4.7++* `simpleMailInMemory`+ ## 0.4.6.1 Add a soft line break when hitting a QPEscape at the end of an encoded line. [#34](https://github.com/snoyberg/mime-mail/pull/34)
Network/Mail/Mime.hs view
@@ -20,10 +20,13 @@ -- * High-level 'Mail' creation , simpleMail , simpleMail'+ , simpleMailInMemory -- * Utilities , addPart , addAttachment , addAttachments+ , addAttachmentBS+ , addAttachmentsBS , htmlPart , plainPart , randomString@@ -335,6 +338,22 @@ simpleMail' to from subject body = addPart [plainPart body] $ mailFromToSubject from to subject +-- | A simple interface for generating an email with HTML and plain-text+-- alternatives and some 'ByteString' attachments.+--+-- Since 0.4.7+simpleMailInMemory :: Address -- ^ to+ -> Address -- ^ from+ -> Text -- ^ subject+ -> LT.Text -- ^ plain body+ -> LT.Text -- ^ HTML body+ -> [(Text, Text, L.ByteString)] -- ^ content type, file name and contents of attachments+ -> Mail+simpleMailInMemory to from subject plainBody htmlBody attachments =+ addAttachmentsBS attachments+ . addPart [plainPart plainBody, htmlPart htmlBody]+ $ mailFromToSubject from to subject+ mailFromToSubject :: Address -- ^ from -> Address -- ^ to -> Text -- ^ subject@@ -371,6 +390,23 @@ addAttachments :: [(Text, FilePath)] -> Mail -> IO Mail addAttachments xs mail = foldM fun mail xs where fun m (c, f) = addAttachment c f m++-- | Add an attachment from a 'ByteString' and construct a 'Part'.+--+-- Since 0.4.7+addAttachmentBS :: Text -- ^ content type+ -> Text -- ^ file name+ -> L.ByteString -- ^ content+ -> Mail -> Mail+addAttachmentBS ct fn content mail =+ let part = Part ct Base64 (Just fn) [] content+ in addPart [part] mail++-- |+-- Since 0.4.7+addAttachmentsBS :: [(Text, Text, L.ByteString)] -> Mail -> Mail+addAttachmentsBS xs mail = foldl fun mail xs+ where fun m (ct, fn, content) = addAttachmentBS ct fn content m data QP = QPPlain S.ByteString | QPNewline
mime-mail.cabal view
@@ -1,5 +1,5 @@ Name: mime-mail-Version: 0.4.6.2+Version: 0.4.7 Synopsis: Compose MIME email messages. description: Hackage documentation generation is not reliable. For up to date documentation, please see: <http://www.stackage.org/package/mime-mail>. Homepage: http://github.com/snoyberg/mime-mail