I managed to get Postal delivery working with Mandrill, still use of 
templates with formatting v helpful. Mailer and Postal have a slight 
problem on recognizing the meta info for smtp auth.

So with some fiddling figured out how to merge Clostache into Postal for 
html templates with dynamic vars as follows:

dependencies:  [com.draines/postal "1.11.1"]
                         [de.ubercode.clostache/clostache "1.3.1"]

(:use       clostache.parser)
(:require  [postal.core :as postal]

(postal/send-message 
    ^{:host "smtp.mandrillapp.com"
      :user "your mandrill acct email address"
      :pass "your mandrill api key"
      :port 587}
     {:type "text/html" 
      :from "from email address"
      :to "to email address"
      :subject (render "Hi from {{firstname}}" {:firstname (session/get 
:firstname)})
      :body [{:type "text/html; charset=utf-8"
              :content (render-resource 
"email/templates/hello.html.mustache" 
               {:name "Uncle Scooby" :memberid (session/get :member-id)}) 
}] })

The hello.html.mustache template file:

    Hello {{name}},<br /><br />

    My member id is: {{memberid}}<br /><br />

    Best,<br />
    Scrappy Doo.

The template path root is the app src folder. So your 
app/src/email/templates/hello.html.mustache

So this works but the use of Clostache still seems a bit boilerplatish. 
Does anyone know of a more elegant option if possible.

Thank you for the other tips, will try out the native java and the other 
Mandrill code option, see which is the best overall approach long term.

-- 
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