(empty-message)
(empty-message session)
creates an empty MimeMessage
(object/to-data (empty-message)) => {:all-headers [], :all-header-lines [], :size -1, :content-type "text/plain", :flags [], :line-count -1}
creates an empty MimeMessage (object/to-data (empty-message)) => {:all-headers [], :all-header-lines [], :size -1, :content-type "text/plain", :flags [], :line-count -1}
(get-recipients k)
gets recipients of a particular field
(-> (doto (empty-message) (.addRecipient (recipient/list :to) (InternetAddress. "z@z.com"))) ((get-recipients :to)) (seq)) ;;=> (#address "z@z.com")
gets recipients of a particular field (-> (doto (empty-message) (.addRecipient (recipient/list :to) (InternetAddress. "z@z.com"))) ((get-recipients :to)) (seq)) ;;=> (#address "z@z.com")
(message {:keys [from to cc bcc subject content text reply-to] :as m})
constructs a MimeMessage from a map
(-> (message {:from "z@z.com" :cc ["a@a.com"] :bcc ["b@b.com" "c@c.com"] :reply-to ["y@y.com"] :subject "Hello There" :body "This is Cool"}) (object/to-data) (select-keys [:all-headers :subject :body])) => {:all-headers [["From" "z@z.com"] ["Reply-To" "y@y.com"] ["Cc" "a@a.com"] ["Bcc" "b@b.com, c@c.com"] ["Subject" "Hello There"]] :subject "Hello There" :body "This is Cool"}
constructs a MimeMessage from a map (-> (message {:from "z@z.com" :cc ["a@a.com"] :bcc ["b@b.com" "c@c.com"] :reply-to ["y@y.com"] :subject "Hello There" :body "This is Cool"}) (object/to-data) (select-keys [:all-headers :subject :body])) => {:all-headers [["From" "z@z.com"] ["Reply-To" "y@y.com"] ["Cc" "a@a.com"] ["Bcc" "b@b.com, c@c.com"] ["Subject" "Hello There"]] :subject "Hello There" :body "This is Cool"}
(set-body m v)
sets the body of a given message
(-> (set-body (empty-message) "Hello World") (object/get :body)) => "Hello World"
sets the body of a given message (-> (set-body (empty-message) "Hello World") (object/get :body)) => "Hello World"
(set-recipients k)
sets recipients of a particular field
(-> (doto (empty-message) ((set-recipients :to) ["a@a.com"]) ((set-recipients :bcc) ["b@b.com"]) ((set-recipients :cc) ["c@c.com"])) (object/to-data) :all-recipients) => ["a@a.com" "c@c.com" "b@b.com"]
sets recipients of a particular field (-> (doto (empty-message) ((set-recipients :to) ["a@a.com"]) ((set-recipients :bcc) ["b@b.com"]) ((set-recipients :cc) ["c@c.com"])) (object/to-data) :all-recipients) => ["a@a.com" "c@c.com" "b@b.com"]
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close