ses-html: Send HTML formatted emails using Amazon's SES REST API with blaze

[ aws, bsd3, email, library, network, web ] [ Propose Tags ]
Dependencies base (>4 && <5), base64‑bytestring, blaze‑html, byteable, bytestring, cryptohash, HsOpenSSL, http‑streams, tagsoup, time (>= [details]
License BSD-3-Clause
Copyright David Johnson
Author David Johnson
Category Web, AWS, Email, Network
Source repo head: git clone
Uploaded by DavidJohnson at Sat Oct 7 20:32:22 UTC 2017
Distributions LTSHaskell:, NixOS:, Stackage:, openSUSE:
Downloads 2136 total (22 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-10-07 [all 1 reports]
Hackage Matrix CI

Send html emails using Amazon's Simple Email Service and Blaze Templating in Haskell

[Skip to Readme]




Maintainer's Corner

For package maintainers and hackage trustees

Readme for ses-html-

[back to package description]


Hackage Hackage Dependencies Haskell Programming Language BSD3 License Build Status

Send blaze-html emails via the AWS SES API using http-streams


{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE LambdaCase #-}

module Main where

import Network.SES ( sendEmailBlaze
                   , PublicKey(..)
                   , SecretKey(..)
                   , SESResult(..)
                   , SESError
                   , Region(USEast1)

import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A

main :: IO ()
main = sendMail >>= \case
         Error _ -> putStrLn "There was an error :("
         Success -> putStrLn "Email sent successfully!"

sendMail :: IO SESREsult
sendMail = sendEmailBlaze publicKey secretKey region from to subject html
   publicKey = PublicKey "public key goes here"
   secretKey = SecretKey "secret key goes here"
   region    = USEast1
   from    = ""
   to      = [""]
   subject = "Test Subject"
   html = H.html $ do
            H.body $ do
               H.img H.! A.src ""
               H.h1 "Html email! Hooray"


<img src=""></img>