org.clojars.number23.commons-lib.mail documentation

fill-msg-content

(fill-msg-content text & files)
Fill message content with text and files,
return java.mail.internet.MimeMultipart.

sendmail

(sendmail & m)
Simple sendmail function by smtp protocol,
base on javax.mail, keys:
host, port, user, password,
auth, ssl,
debug,
from, to, cc, bcc,
subject, text, content

if debug is true, debug output, send to bcc only,
from is String, to, cc, and bcc is vec,
if text is setup, send text/plan msg
content is javax.mail.Multipart.

usag:

(sendmail
  :host "smtp.gmail.com"
  :user "number23.cn@gmail.com"
  :password "secret_password"
  :port "587"
  :auth true
  :ssl true
  :debug false
  :from "number23.cn@gmail.com"
  :to ["number23.cn@gmail.com"]
  :subject "Sendmail by Clojure"
  :text "Test")

with Multipart:

(import 'javax.mail.internet.MimeMultipart)
(import 'javax.mail.internet.MimeBodyPart)

(let [mp (MimeMultipart.)
      hp (MimeBodyPart.)]
  (.setContent hp "<H1>Hello Clojure</H1>" "text/html")
  (.addBodyPart mp hp)

  (sendmail
    :content mp
    ...))