https://github.com/gws/clj-mandrill
A Clojure implementation of the Mandrill API
https://github.com/gws/clj-mandrill
clojure email mandrill
Last synced: 19 days ago
JSON representation
A Clojure implementation of the Mandrill API
- Host: GitHub
- URL: https://github.com/gws/clj-mandrill
- Owner: gws
- Created: 2014-02-10T11:39:26.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2017-08-31T22:08:24.000Z (over 8 years ago)
- Last Synced: 2025-10-21T23:56:25.659Z (2 months ago)
- Topics: clojure, email, mandrill
- Language: Clojure
- Homepage:
- Size: 122 KB
- Stars: 15
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
# clj-mandrill
[](https://travis-ci.org/gws/clj-mandrill)
[](https://jarkeeper.com/gws/clj-mandrill)
A Clojure library for consuming the
[Mandrill](https://mandrillapp.com) API.
## Installation
[](https://clojars.org/gws/clj-mandrill)
## Documentation
[API documentation](https://gws.github.io/clj-mandrill/)
## Usage
```clojure
(ns your.app
(:require [gws.mandrill.client :as client]
[gws.mandrill.api.messages :as messages]))
; Create a default Mandrill client with your API key. You can also specify a map
; of clj-http parameters, but that's optional.
(def client (client/create "YOUR-SECRET-KEY"))
;(def client (client/create "YOUR-SECRET-KEY" {:socket-timeout 1000}))
; Build up an interesting message to send.
(def msg {:message {:to [{:email "nobody@example.com"
:name "Nobody"}]
:from_email "you@yourdomain.com"
:subject "This is a test"
:text "Really interesting text-only content."}})
; You can override the key per-request, per the Mandrill docs. This will
; override your client API key configuration.
;(def msg {:key "YOUR KEY"
; :message {...}})
; Send the message using the configured Mandrill client.
; Functions are named in an attempt to be consistent with the Mandrill REST API
; endpoints.
(messages/send client msg)
```
## Features
The entire [Mandrill API version 1.0](https://mandrillapp.com/api/docs/) is supported.
The API follows the Mandrill API conventions as closely as possible. In other
words, messages calls are in the `gws.mandrill.api.messages` namespace, and the
calls are lowercased functions in that namespace, such as
`gws.mandrill.api.messages/send`.
## Testing
Most of the tests are run against the actual Mandrill API, since Mandrill
provides test API keys. In order to actually run the tests, you need to obtain a
test API key. Once you’ve done this, you can supply the key as an environment
variable:
```sh
# Be absolutely sure this is a test key, not your production key!
MANDRILL_TEST_API_KEY=YOURTESTKEY lein test
```
## License
Copyright © 2014 Gordon Stratton
Licensed under the [Apache License version 2.0](https://www.apache.org/licenses/LICENSE-2.0).