https://github.com/damesek/clojure-sendgrid-v3
Example code for sendgrid V3 API with clojure
https://github.com/damesek/clojure-sendgrid-v3
Last synced: about 1 year ago
JSON representation
Example code for sendgrid V3 API with clojure
- Host: GitHub
- URL: https://github.com/damesek/clojure-sendgrid-v3
- Owner: damesek
- Created: 2017-03-11T15:20:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-11T18:21:30.000Z (over 9 years ago)
- Last Synced: 2023-09-12T10:42:13.978Z (almost 3 years ago)
- Language: Clojure
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# clojure-sendgrid-v3
Example code for sendgrid V3 API with clojure
Authorization example. I used clj-http.client (:as http) and clojure.data.json (:as json) library for this. If you would like to send out `text/html` newsletter/ email out, just change type of the content and add to value a html content.
*The html version*
```
.....
[clj-http.client :as http]
[clojure.data.json :as json]
.....
(def queryhtml "
Hello, world!
")
(http/post "https://api.sendgrid.com/v3/mail/send"
{:content-type "application/json"
:headers {:Authorization "Bearer YOUR KEY HERE"}
:body (json/write-str {:personalizations [{:to [{"email" "your@emailaddress.com"}]}]
:from {"email" "from@email.com"}
:subject "test"
:content [{:type "text/html"
:value queryhtml}]
})
})
```
Test your sender configuration with mail-tester.com.
https://sendgrid.com/docs/API_Reference/api_v3.html