git.iko.soy/typeable/mandrill
on messages-calls help sign in
62 lines 1.7 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# Example
11This package was built with pragmatism and reuse in mind. This means
12this API comes in two flavours: an IO-based and an handy monad transformers
13which can be plugged in your stack of choice.
14Example:
16``` haskell
17{-# LANGUAGE OverloadedStrings #-}
18import Text.Email.Validate
19import Network.API.Mandrill
21main :: IO ()
22main = do
23 case validate "foo@example.com" of
24 Left err -> print $ "Invalid email!" ++ show err
25 Right addr -> runMandrill "MYTOKENHERE" $ do
26 let msg = "<p>My Html</p>"
27 res <- sendEmail (newTextMessage addr addr "Hello" msg)
28 case res of
29 MandrillSuccess k -> liftIO (print k)
30 MandrillFailure f -> liftIO (print f)
31```
33# Supported API versions
35* 1.0 (partially)
36 - [Users call](https://mandrillapp.com/api/docs/users.JSON.html) - 100%
37 + info.json
38 + ~~ping.json~~ (as **doesn't return valid json!**)
39 + ping2.json
40 + senders.json
41 - [Messages call](https://mandrillapp.com/api/docs/messages.JSON.html)
42 + send.json
44# Testing online API
46To test the online API, first build the package with tests enabled:
48```
49cabal install --enable-tests
50```
52Then export an environment variable with your Mandrill **Test** token:
54```
55export MANDRILL_API_KEY="YOURKEYGOESHERE"
56```
58And finally execute the testsuite:
60```
61cabal test
62```