git.iko.soy/typeable/mandrill
on release-0.5.2.1 help sign in
13 lines 451 B history raw
1{-# LANGUAGE OverloadedStrings #-}
2import Text.Email.Validate
3import Network.API.Mandrill
5main :: IO ()
6main = case validate "foo@example.com" of
7 Left err -> print $ "Invalid email!" ++ show err
8 Right addr -> runMandrill "SUPER-SECRET-TOKEN" $ do
9 let msg = "<p>My Html</p>"
10 res <- sendEmail (newTextMessage addr [addr] "Hello" msg)
11 case res of
12 MandrillSuccess k -> liftIO (print k)
13 MandrillFailure f -> liftIO (print f)