Skip to content

Instantly share code, notes, and snippets.

@campeterson
Last active September 19, 2019 05:10
Show Gist options
  • Save campeterson/64988420e7d4f2dab2f4b920a394d3f6 to your computer and use it in GitHub Desktop.
Save campeterson/64988420e7d4f2dab2f4b920a394d3f6 to your computer and use it in GitHub Desktop.
Send email from Clojure AWS API
;;https://github.com/cognitect-labs/aws-api
(require '[cognitect.aws.client.api :as aws])
(def ses (aws/client {:api :email}))
(aws/ops ses)
(keys (aws/ops ses))
(aws/doc ses :SendEmail)
;; Email addresses must be verified if in sandbox mode
(def payload
{:Destination {:ToAddresses ["[email protected]"]}
:Message {:Subject {:Charset "UTF-8"
:Data "Sent from AWS SES"}
:Body {:Text {:Charset "UTF-8"
:Data "This is the body of my email"}}}
:Source "[email protected]"})
(aws/invoke ses {:op :SendEmail :request payload})
{:deps {com.cognitect.aws/api {:mvn/version "0.8.352"}
com.cognitect.aws/endpoints {:mvn/version "1.1.11.607"}
com.cognitect.aws/email {:mvn/version "742.2.527.0"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment