summaryrefslogtreecommitdiff
path: root/test/SendMany.hs
diff options
context:
space:
mode:
Diffstat (limited to 'test/SendMany.hs')
-rw-r--r--test/SendMany.hs31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/SendMany.hs b/test/SendMany.hs
new file mode 100644
index 0000000..6ae9adc
--- /dev/null
+++ b/test/SendMany.hs
@@ -0,0 +1,31 @@
+{-# LANGUAGE OverloadedStrings #-}
+
+module Main where
+
+import Control.Monad.IO.Class
+import Data.Text as T (Text (..), pack)
+import Network.HTTP.Conduit
+import Rackspace.MailGun
+import System.Environment
+
+main :: IO ()
+main = do
+ domain <- getEnv "MAILGUN_DOMAIN"
+ apiKey <- getEnv "MAILGUN_SECRET"
+ testAddr <- getEnv "MAILGUN_TEST_ADDRESS"
+
+ let message = TextMessage
+ { from = T.pack ("someone@" ++ domain)
+ , to = T.pack testAddr
+ , cc = Nothing
+ , bcc = Nothing
+ , subject = Just "Test Message"
+ , text = "Hello, this is a test message!" }
+ withManager $ \manager -> do
+ let sendW = sendWith manager
+ res1 <- sendW domain apiKey message
+ res2 <- sendW domain apiKey message
+ res3 <- sendW domain apiKey message
+ liftIO $ print res1
+ liftIO $ print res2
+ liftIO $ print res3