clojure-postmark / README.markdown

clojure-postmark

clojure-postmark lets you talk to Postmark from Clojure.

Installation

Slap this in your project.clj :dependencies:

[postmark "1.1.0"]

Usage

First you need to load the postmark function:

;; In an (ns)
(:use [postmark.core :only (postmark)])

;; Outside an (ns)
(use '[postmark.core :only (postmark)])

Create a customized postmark function:

(def pm (postmark "YOUR_API_KEY" "from-address@example.com"))

Now just call the function to send an email:

(pm {:to "fluffy@example.com"
     :subject "Your Noms"
     :text "I wants them."})

You can send to multiple addresses by using a seq for :to, but remember that Postmark's API won't let you send to more than twenty recipients at a time:

(pm {:to ["fluffy@example.com" "sprinkles@example.com"]
     :subject "All of Your Noms"
     :text "I wants them."})

There are a few other keys you can use in the map you pass to the call:

(pm {:to ["fluffy@example.com" "sprinkles@example.com"]
     :cc ["haiku@example.com"]
     :bcc ["admin@example.com"]
     :subject "All of Your Noms"
     :text "I wants them."
     :html "I <b>wants</b> them."
     :tag "Noms"
     :reply-to "avedon@example.com"})

Testing

If you just want to run a test you can use postmark-test without an API key instead of postmark:

(use '[postmark.core :only (postmark-test)])
(def pt (postmark-test "from-address@example.com"))

(pt {:to ["fluffy@example.com" "sprinkles@example.com"]
     :subject "Testing"
     :text "I might want your noms."})

Todo List

  • Automatically generate plain text body if you just pass an html body.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.