summaryrefslogtreecommitdiff
path: root/test/Send.hs
blob: 94b47e8305346d657d4b275f18f53825ef63fd38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{-# LANGUAGE OverloadedStrings #-}

module Main where

import           Data.Text          as T (Text (..), pack)
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!" }
        res <- sendMessage domain apiKey message
        print res