(email-event smtp-opts msg-opts events & [keys html-template])
Sends an event or a sequence of events via email
Sends an event or a sequence of events via email * *smtp-opts* SMTP options passed to Postal to send the email * *msg-opts* Message options passed to Postal to send the email. Value of :body is replaced with HTML produced by make-header, event->html and make-footer * *events* to be sended * keys (optional) keys to be sended * html-template (optional) to produce a representation of an event
(event->html arp-event & [html-template])
Produces a HTML representation of an event
Produces a HTML representation of an event * *arp-event* to be represented in HTML * html-template (optional) to produce a representation of an event. This template uses vectors to represent elements and is parsed using Hiccup and replaces arp-event key ocurrences into vectors with its value
(mailer)
(mailer opts)
(mailer smtp-opts msg-opts & [keys html-template])
Returns a mailer, which is a function invoked with a map of options and returns a stream that takes a single or a sequence of events, and sends an email about them.
Examples:
;; Mailer that uses a local sendmail
(def email (mailer))
;; Mailer with mixed Postal options
(def email (mailer {:host 'smtp.gmail.com'
:user 'sample@gmail.com'
:pass 'somesecret'
:subject 'Help!!'
:to ['ops@example.com' 'support@example.com']
:ssl :yes}))
;; Invoking email sending only :message and :ts fields
(email event [:message :ts])
;; Invoking email sending only :message and :ts fields into a custom template
(email event [:message :ts] [:p [:em :message] ' since ' [:i :ts]])
;; Sends max 5 email each 15 minutes using rollup
(stateful/rollup :host 5 (* 60000 15)
(mailer smtp-opts))
Returns a mailer, which is a function invoked with a map of options and returns a stream that takes a single or a sequence of events, and sends an email about them. Examples: ``` ;; Mailer that uses a local sendmail (def email (mailer)) ;; Mailer with mixed Postal options (def email (mailer {:host 'smtp.gmail.com' :user 'sample@gmail.com' :pass 'somesecret' :subject 'Help!!' :to ['ops@example.com' 'support@example.com'] :ssl :yes})) ;; Invoking email sending only :message and :ts fields (email event [:message :ts]) ;; Invoking email sending only :message and :ts fields into a custom template (email event [:message :ts] [:p [:em :message] ' since ' [:i :ts]]) ;; Sends max 5 email each 15 minutes using rollup (stateful/rollup :host 5 (* 60000 15) (mailer smtp-opts)) ```
(make-footer)
Creates a default footer with a simple text
Creates a default footer with a simple text
(make-header title)
Creates a default header with a simple title
Creates a default header with a simple title * *title* replaced in mail header
(make-table-template source)
Creates a default html view from an arbitrary source map
Creates a default html view from an arbitrary source map * *source* arbitrary map to build a template
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close