(clear-mail mailbox)
clears mail for the entire mailbox
(let [box (mailbox {:id :test :type :mock :addresses ["a@a.com"]})] (-> (mailer {:type :mock}) (send-bulk [{:to ["a@a.com"] :body "Test A"} {:to ["a@a.com"] :body "Test B"} {:to ["a@a.com"] :body "Test C"}])) (clear-mail box) (count-mail box)) => 0
clears mail for the entire mailbox (let [box (mailbox {:id :test :type :mock :addresses ["a@a.com"]})] (-> (mailer {:type :mock}) (send-bulk [{:to ["a@a.com"] :body "Test A"} {:to ["a@a.com"] :body "Test B"} {:to ["a@a.com"] :body "Test C"}])) (clear-mail box) (count-mail box)) => 0
(copy-mailbox from to)
copies the contents of one mailbox to another
(def boxA (mailbox -test-imap-))
(def boxB (mailbox {:id :test :type :mock}))
(copy-mailbox boxA boxB)
(= (mapv (comp :all-headers object/to-data) (list-mail boxA)) (mapv (comp :all-headers object/to-data) (list-mail boxB))) => true
copies the contents of one mailbox to another (def boxA (mailbox -test-imap-)) (def boxB (mailbox {:id :test :type :mock})) (copy-mailbox boxA boxB) (= (mapv (comp :all-headers object/to-data) (list-mail boxA)) (mapv (comp :all-headers object/to-data) (list-mail boxB))) => true
(count-mail mailbox)
counts the number of mail in the mailbox
(let [box (mailbox {:id :test :type :mock :addresses ["a@a.com"]})] (-> (mailer {:type :mock}) (send-bulk [{:to ["a@a.com"] :body "Test A"} {:to ["b@b.com"] :body "Test B"} {:to ["c@c.com"] :body "Test C"}])) (count-mail box)) => 1
counts the number of mail in the mailbox (let [box (mailbox {:id :test :type :mock :addresses ["a@a.com"]})] (-> (mailer {:type :mock}) (send-bulk [{:to ["a@a.com"] :body "Test A"} {:to ["b@b.com"] :body "Test B"} {:to ["c@c.com"] :body "Test C"}])) (count-mail box)) => 1
(create-mailbox m)
creates a mailbox for use with hara.core.component
(create-mailbox {:type :mock :addresses ["a@a.com"]})
(create-mailbox -test-imap-)
creates a mailbox for use with hara.core.component (create-mailbox {:type :mock :addresses ["a@a.com"]}) (create-mailbox -test-imap-)
(create-mailer m)
creates a mailer for use with hara.core.component
(create-mailer {:type :mock})
(create-mailer {:type :local})
(create-mailer -test-smtp-)
creates a mailer for use with hara.core.component (create-mailer {:type :mock}) (create-mailer {:type :local}) (create-mailer -test-smtp-)
(get-mail mailbox i)
retrieves mail at a given index
(let [box (mailbox {:id :test :type :mock :addresses ["a@a.com"]})] (-> (mailer {:type :mock}) (send-mail {:to ["a@a.com"] :body "Test A"})) (-> (get-mail box 0) (object/to-data))) => (contains {:to ["a@a.com"] :body "Test A"})
retrieves mail at a given index (let [box (mailbox {:id :test :type :mock :addresses ["a@a.com"]})] (-> (mailer {:type :mock}) (send-mail {:to ["a@a.com"] :body "Test A"})) (-> (get-mail box 0) (object/to-data))) => (contains {:to ["a@a.com"] :body "Test A"})
(init-mail mailbox messages)
sets the mailbox with the inital messages (let [box (mailbox {:id :test :type :mock})] (init-mail box (mapv message [{:to ["a@a.com"] :body "Test A"}])) (count-mail box)) => 1
sets the mailbox with the inital messages (let [box (mailbox {:id :test :type :mock})] (init-mail box (mapv message [{:to ["a@a.com"] :body "Test A"}])) (count-mail box)) => 1
(list-mail mailbox)
retrieves all mail in the mailbox
(let [box (mailbox {:id :test :type :mock :addresses ["a@a.com"]})] (-> (mailer {:type :mock}) (send-bulk [{:to ["a@a.com"] :body "Test A"} {:to ["a@a.com"] :body "Test B"} {:to ["a@a.com"] :body "Test C"}])) (-> (list-mail box) (object/to-data))) => (contains-in [{:body "Test A"} {:body "Test B"} {:body "Test C"}])
retrieves all mail in the mailbox (let [box (mailbox {:id :test :type :mock :addresses ["a@a.com"]})] (-> (mailer {:type :mock}) (send-bulk [{:to ["a@a.com"] :body "Test A"} {:to ["a@a.com"] :body "Test B"} {:to ["a@a.com"] :body "Test C"}])) (-> (list-mail box) (object/to-data))) => (contains-in [{:body "Test A"} {:body "Test B"} {:body "Test C"}])
(mailbox m)
creates an active mailbox
(mailbox {:type :mock}) ;; => #mailbox.mock{:id "8c465d04-fdaa-4401-997e-cd6ed3d9d732", ;; :messages 0, :addresses #{}}
(mailbox -test-pop3-)
creates an active mailbox (mailbox {:type :mock}) ;; => #mailbox.mock{:id "8c465d04-fdaa-4401-997e-cd6ed3d9d732", ;; :messages 0, :addresses #{}} (mailbox -test-pop3-)
(mailer m)
creates an active mailer
(mailer {:type :mock})
(mailer -test-smtp-)
creates an active mailer (mailer {:type :mock}) (mailer -test-smtp-)
(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"}
(send-bulk mailer messages)
sends a list of mail to the given address
(-> (mailer {:type :mock}) (send-bulk [{:to ["a@a.com"] :body "Test A"} {:to ["b@b.com"] :body "Test B"} {:to ["c@c.com"] :body "Test C"}]))
sends a list of mail to the given address (-> (mailer {:type :mock}) (send-bulk [{:to ["a@a.com"] :body "Test A"} {:to ["b@b.com"] :body "Test B"} {:to ["c@c.com"] :body "Test C"}]))
(send-mail mailer {:keys [to cc bcc subject body] :as message})
sends mail to the given address
(-> (mailer {:type :mock}) (send-mail {:to ["a@a.com"] :body "Test"}))
sends mail to the given address (-> (mailer {:type :mock}) (send-mail {:to ["a@a.com"] :body "Test"}))
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close