git.iko.soy/typeable/mandrill
on issue-28 help sign in
98 lines 2.6 kB history raw
1[![Build Status](https://travis-ci.org/adinapoli/mandrill.svg?branch=master)](https://travis-ci.org/adinapoli/mandrill)
2[![Coverage Status](https://img.shields.io/coveralls/adinapoli/mandrill.svg)](https://coveralls.io/r/adinapoli/mandrill)
4# Haskell Client for the Mandrill JSON API
6This module implement a low-level, 1:1 mapping API to
7the [Mandrill](http://mandrillapp.com) transactional email service.
9# Changelog
11## Version 0.5.1.0
13* Relaxed the constraint on `aeson` to allow `0.11.0.0`.
15## Version 0.5.0.0
17* Changed the `MandrillHeaders` type synonym from `Value` to `Object`.
19* Changed the `mmsg_metadata` and `mmdt_values` fields from `MandrillVars` to `Object`.
21* Changed the `mmsg_global_merge_vars` and `mmvr_vars` fields from `[MandrillVars]` to `[MergeVar]`
23* Added the `MergeVar` data type:
25```haskell
26data MergeVar = MergeVar {
27 _mv_name :: !Text
28 , _mv_content :: Value
29 }
30```
32* Removed the `MandrillVars` type synonym.
34## Version 0.4.0.0
36* Modified the `Base64ByteString` type to accept another constructor. This
37 allows the user to pass already-encoded Base64 strings which might be coming
38 upstream.
40# Example
42This package was built with pragmatism and reuse in mind. This means
43this API comes in two flavours: an IO-based and an handy monad transformer
44which can be plugged in your stack of choice.
45Example:
47``` haskell
48{-# LANGUAGE OverloadedStrings #-}
49import Text.Email.Validate
50import Network.API.Mandrill
52main :: IO ()
53main = do
54 case validate "foo@example.com" of
55 Left err -> print $ "Invalid email!" ++ show err
56 Right addr -> runMandrill "MYTOKENHERE" $ do
57 let msg = "<p>My Html</p>"
58 res <- sendEmail (newTextMessage addr [addr] "Hello" msg)
59 case res of
60 MandrillSuccess k -> liftIO (print k)
61 MandrillFailure f -> liftIO (print f)
62```
64# Supported API versions
66* 1.0 (partially)
67 - [Users call](https://mandrillapp.com/api/docs/users.JSON.html) - 100%
68 + info.json
69 + ~~ping.json~~ (as **doesn't return valid json!**)
70 + ping2.json
71 + senders.json
72 - [Messages call](https://mandrillapp.com/api/docs/messages.JSON.html)
73 + send.json
75# Testing online API
77To test the online API, first build the package with tests enabled:
79```
80cabal install --enable-tests
81```
83Then export an environment variable with your Mandrill **Test** token:
85```
86export MANDRILL_API_KEY="YOURKEYGOESHERE"
87```
89And finally execute the testsuite:
91```
92cabal test
93```
95# Contributions
96This library scratches my own itches, but please fork away!
97Pull requests are encouraged to implement the part of the API
98you need.