git.iko.soy/typeable/mandrill
on issue-stackage-845 help sign in
75 lines 2.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.4.0.0
13* Modified the `Base64ByteString` type to accept another constructor. This
14 allows the user to pass already-encoded Base64 strings which might be coming
15 upstream.
17# Example
19This package was built with pragmatism and reuse in mind. This means
20this API comes in two flavours: an IO-based and an handy monad transformer
21which can be plugged in your stack of choice.
22Example:
24``` haskell
25{-# LANGUAGE OverloadedStrings #-}
26import Text.Email.Validate
27import Network.API.Mandrill
29main :: IO ()
30main = do
31 case validate "foo@example.com" of
32 Left err -> print $ "Invalid email!" ++ show err
33 Right addr -> runMandrill "MYTOKENHERE" $ do
34 let msg = "<p>My Html</p>"
35 res <- sendEmail (newTextMessage addr [addr] "Hello" msg)
36 case res of
37 MandrillSuccess k -> liftIO (print k)
38 MandrillFailure f -> liftIO (print f)
39```
41# Supported API versions
43* 1.0 (partially)
44 - [Users call](https://mandrillapp.com/api/docs/users.JSON.html) - 100%
45 + info.json
46 + ~~ping.json~~ (as **doesn't return valid json!**)
47 + ping2.json
48 + senders.json
49 - [Messages call](https://mandrillapp.com/api/docs/messages.JSON.html)
50 + send.json
52# Testing online API
54To test the online API, first build the package with tests enabled:
56```
57cabal install --enable-tests
58```
60Then export an environment variable with your Mandrill **Test** token:
62```
63export MANDRILL_API_KEY="YOURKEYGOESHERE"
64```
66And finally execute the testsuite:
68```
69cabal test
70```
72# Contributions
73This library scratches my own itches, but please fork away!
74Pull requests are encouraged to implement the part of the API
75you need.