drewr / postal
- Source
- Commits
- Network (0)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
commit bcbeb7488541a78aca012f6ebae43d6a5a17171f
tree b5104ec67a776e41f159c9072dd9a5461a073523
parent efb1ba85401a68ad960d247368d6a77416539e0b
tree b5104ec67a776e41f159c9072dd9a5461a073523
parent efb1ba85401a68ad960d247368d6a77416539e0b
postal /
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Sun Jul 26 17:44:32 -0700 2009 | |
| |
LICENSE | Mon Apr 20 16:40:18 -0700 2009 | |
| |
Makefile | Mon Apr 20 16:26:55 -0700 2009 | |
| |
README.markdown | Sun Jul 26 17:50:14 -0700 2009 | |
| |
bin/ | Sun Jul 26 17:51:35 -0700 2009 | |
| |
build.xml | Tue Aug 04 11:03:20 -0700 2009 | |
| |
ivy.xml | Tue Aug 04 11:03:20 -0700 2009 | |
| |
ivysettings.xml | Fri Sep 11 12:54:44 -0700 2009 | |
| |
src/ | Thu Sep 10 15:35:22 -0700 2009 |
README.markdown
Postal
Internet email library for Clojure
Postal is a library for constructing and sending RFC822-compliant Internet email messages. It wraps the JavaMail package for message and SMTP support. It supports sendmail natively.
Platforms
- Any Unix platform that supports Java and sendmail (
msmtp, et al.) - Untested on Windows
Dependencies
- JavaMail 1.4.2 (in
lib/after build)
Examples
At a bare minimum, provide a map with :from, :to, :subject, and :body.
This will locally inject the message into sendmail.
user> (in-ns 'com.draines.postal.core)
#<Namespace com.draines.postal.core>
com.draines.postal.core> (send-message {:from "me@draines.com"
:to ["mom@example.com" "dad@example.com"]
:cc "bob@example.com"
:subject "Hi!"
:body "Test."})
{:code 0, :error :SUCCESS, :message "message sent"}
com.draines.postal.core>
To use SMTP, add metadata with a :host key.
com.draines.postal.core> (send-message #^{:host "mail.isp.net"}
{:from "me@draines.com"
:to "foo@example.com"
:subject "Hi!"
:body "Test."})
{:code 0, :error :SUCCESS, :message "message sent"}
com.draines.postal.core>
Attachments and multipart messages can be added as sequences of maps:
com.draines.postal.core> (send-message #^{:host "mail.isp.net"}
{:from "me@draines.com"
:to "foo@example.com"
:subject "Hi!"
:body [{:type "text/html"
:content "<b>Test!</b>"}
;;;; supports both dispositions:
{:type :attachment
:content (java.io.File. "/tmp/foo.txt")}
{:type :inline
:content (java.io.File. "/tmp/foo.txt")}]})
{:code 0, :error :SUCCESS, :message "message sent"}
com.draines.postal.core>
Building
% ant dist
% ls dist
postal-20090726194310+32b4b1f.jar
License
Postal is (c) 2009 Drew Raines and released under the MIT license.
