Skip to content

Instantly share code, notes, and snippets.

@tnoborio
Created August 18, 2010 03:11
Show Gist options
  • Save tnoborio/533238 to your computer and use it in GitHub Desktop.
Save tnoborio/533238 to your computer and use it in GitHub Desktop.
(ns mail
(import [org.apache.commons.mail
SimpleEmail]))
(defn sendmail [& {:keys [from to subject content charset host],
:or {charset "iso-2022-jp"}}]
(doto (SimpleEmail.)
(.setHostName host)
(.setCharset charset)
(.setContent content (str "text/plain; charset=" charset))
(.setSubject subject)
(.addTo to)
(.setFrom from)
(.send)))
; (sendmail :from "t.noborio@gmail.com" :to "t.noborio@gmail.com" :subject "件名" :content "ほげ" :host "localhost")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment