git.iko.soy/typeable/mandrill
on release-0.5.2.2 help sign in
118 lines 3.1 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.2.2
13* Added support for QuickCheck-2.9 by relaxing its upper bound.
15## Version 0.5.2.1
17* Added `Functor`, `Foldable` and `Traversable` instances to `MandrillResponse` (Courtesy of @dredozubov)
19## Version 0.5.2.0
21* Added inbound calls (Courtesy of @mwotton)
23## Version 0.5.1.0
25* Relaxed the constraint on `aeson` to allow `0.11.0.0`.
27## Version 0.5.0.0
29* Changed the `MandrillHeaders` type synonym from `Value` to `Object`.
31* Changed the `mmsg_metadata` and `mmdt_values` fields from `MandrillVars` to `Object`.
33* Changed the `mmsg_global_merge_vars` and `mmvr_vars` fields from `[MandrillVars]` to `[MergeVar]`
35* Added the `MergeVar` data type:
37```haskell
38data MergeVar = MergeVar {
39 _mv_name :: !Text
40 , _mv_content :: Value
41 }
42```
44* Removed the `MandrillVars` type synonym.
46## Version 0.4.0.0
48* Modified the `Base64ByteString` type to accept another constructor. This
49 allows the user to pass already-encoded Base64 strings which might be coming
50 upstream.
52# Example
54This package was built with pragmatism and reuse in mind. This means
55this API comes in two flavours: an IO-based and an handy monad transformer
56which can be plugged in your stack of choice.
57Example:
59``` haskell
60{-# LANGUAGE OverloadedStrings #-}
61import Text.Email.Validate
62import Network.API.Mandrill
64main :: IO ()
65main = do
66 case validate "foo@example.com" of
67 Left err -> print $ "Invalid email!" ++ show err
68 Right addr -> runMandrill "MYTOKENHERE" $ do
69 let msg = "<p>My Html</p>"
70 res <- sendEmail (newTextMessage addr [addr] "Hello" msg)
71 case res of
72 MandrillSuccess k -> liftIO (print k)
73 MandrillFailure f -> liftIO (print f)
74```
76# Supported API versions
78* 1.0 (partially)
79 - [Users call](https://mandrillapp.com/api/docs/users.JSON.html) - 100%
80 + info.json
81 + ~~ping.json~~ (as **doesn't return valid json!**)
82 + ping2.json
83 + senders.json
85 - [Messages call](https://mandrillapp.com/api/docs/messages.JSON.html)
86 + send.json
88 - [Senders call](https://mandrillapp.com/api/docs/senders.JSON.html)
89 + verify-domain.json
91 - [Inbound call](https://mandrillapp.com/api/docs/inbound.JSON.html)
92 + add-route.json
93 + add-domain.json
95# Testing online API
97To test the online API, first build the package with tests enabled:
99```
100cabal install --enable-tests
101```
103Then export an environment variable with your Mandrill **Test** token:
105```
106export MANDRILL_API_KEY="YOURKEYGOESHERE"
107```
109And finally execute the testsuite:
111```
112cabal test
113```
115# Contributions
116This library scratches my own itches, but please fork away!
117Pull requests are encouraged to implement the part of the API
118you need.