Created
October 17, 2014 18:37
-
-
Save pbrisbin/3dcfc1bd640e8ccf7d2e to your computer and use it in GitHub Desktop.
SendGrid test via Haskell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE OverloadedStrings #-} | |
| module Main where | |
| import Network.Mail.Mime | |
| import Network.Mail.SMTP | |
| import qualified Data.Text.Lazy as TL | |
| -- Get from e.g. `heroku config` | |
| username = "" | |
| password = "" | |
| recipient = Address (Just "name") "email" | |
| main :: IO () | |
| main = do | |
| let mail = simpleMail' recipient from subject body | |
| sendMailWithLogin' "smtp.sendgrid.net" 587 username password mail | |
| where | |
| from = Address (Just "SendGrid Test") "noreply@example.com" | |
| subject = "Sent via SendGrid using Haskell" | |
| body = TL.unlines | |
| [ "Hi there," | |
| , "" | |
| , "Did you get this?" | |
| , "" | |
| , "Thanks," | |
| , "SendGrid Test" | |
| ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment