How about the JavaMail API? here is an example :

(defn- map->properties
"Converts a Map<String, String> to a java.util.Properties object."
[^java.util.Map property-value-map]
 {:pre [(every? #(every? string? %) property-value-map)]}
  (doto (java.util.Properties.)
    (.putAll property-value-map)))

(defn mail "Send email programmatically."
[{:keys [from to subject text password host ssl? port]}]
{:pre [(string? from) (string? host)     (string? subject)
          (string? text) (string? password) (seq to)]}
  (let [auth (proxy [Authenticator] []
               (getPasswordAuthentication []
                 (PasswordAuthentication. from password)))
        props (map->properties {"mail.smtp.user" from
                                     "mail.smtp.host" host
                                     "mail.smtp.starttls.enable" (str ssl?)
                                     "mail.smtp.auth" "true"
                                     "mail.smtp.port" (str port)})
        session (Session/getInstance props auth)
        msg (doto (MimeMessage. session)
              (.setText text)
              (.setSubject subject)
              (.setFrom (InternetAddress. from))) ]
    (doseq [addr to]
      (.addRecipient msg Message$RecipientType/TO (InternetAddress. addr)))
    (Transport/send msg)
(println (str "The e-mail titled <" subject "> has left the building..."))))

(defn gmail "Send email with GMail."
 [opt-map]
 (mail
   (merge opt-map {:host "smtp.gmail.com"
                   :ssl? true
                   :port 587})))

Jim


On 24/02/14 10:33, The Dude (Abides) wrote:
Hi, I'm new to clojure and have got a productive handle on CRUD, sessions, routing, writing functions. Last couple things are email delivery, image processing (resizing).

So I looked on the clojure-toolbox site for email delivery libs with smtp authentication for a Mandrill acct fo transactional emails. I've used Mandrill in other langs right away zero glitch. Here's the results thus far in Clojure as a frame of reference for web domain use 2014:

POSTAL
https://github.com/drewr/postal#encryption-gmail-example

Doesn't deliver. Tried number of examples in the docs.

MAILER
https://github.com/clojurewerkz/mailer

Worked briefly, but not via Mandrill, no emails reached there. Authentication settings have no impact, uses Postal above lib for delivery. Tried number of examples in the docs.

CLJ MAIL
https://github.com/MayDaniel/clj-mail

Out of date syntax.

I googled and found a couple more in the quest to avoid having to do this via java heaven forbid:

MMEmail
http://blog.8thlight.com/micah-martin/2010/04/21/mmemail-my-first-clojure-open-source-contribution.html

Says cannot connect to port 25 although my settings specify port 587 for Mandrill

POSTMARK
http://sjl.bitbucket.org/clojure-postmark/

Transactional email delivery service with a clojure lib. Will create an acct in morning and try it out.

Doe anyone know of any other smooth workable out the gate solutions for email delivery?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to