Liking cljdoc? Tell your friends :D

taoensso.telemere.postal

Email handler using postal, Ref. https://github.com/drewr/postal.

Email handler using `postal`,
Ref. <https://github.com/drewr/postal>.
raw docstring

default-dispatch-optsclj


handler:postalclj

(handler:postal {:keys [conn-opts msg-opts subject-fn body-fn]
                 :or {subject-fn (signal-subject-fn)
                      body-fn (utils/format-signal-fn)}})

Experimental, subject to change.

Needs postal, Ref. https://github.com/drewr/postal.

Returns a signal handler that:

  • Takes a Telemere signal (map).
  • Sends the signal as an email to specified recipient.

Useful for emailing important alerts to admins, etc.

Default handler dispatch options (override when calling add-handler!): :min-level - :info :rate-limit - [[5 (enc/msecs :mins 1)] ; Max 5 emails in 1 min [10 (enc/msecs :mins 15)] ; Max 10 emails in 15 mins [15 (enc/msecs :hours 1)] ; Max 15 emails in 1 hour [30 (enc/msecs :hours 6)] ; Max 30 emails in 6 hours ]

Options: :conn-opts - Map of connection opts given to postal/send-message Examples: {:host "mail.isp.net", :user "jsmith", :pass "a-secret"}, {:host "smtp.gmail.com", :user "jsmith@gmail.com", :pass "a-secret" :port 587 :tls true}, {:host "email-smtp.us-east-1.amazonaws.com", :port 587, :tls true, :user "AKIAIDTP........", :pass "AikCFhx1P......."}

:msg-opts - Map of message opts given to postal/send-message Examples: {:from "foo@example.com", :to "bar@example.com"}, {:from "Alice <foo@example.com", :to "Bob bar@example.com"}, {:from "no-reply@example.com", :to ["first-responders@example.com", "devops@example.com"], :cc "engineering@example.com" :X-MyHeader "A custom header"}

:subject-fn - (fn [signal]) => email subject string :body-fn - (fn [signal]) => email body content string, see format-signal-fn or pr-signal-fn

Tips:

  • Ref. https://github.com/drewr/postal for more info on postal options.
  • Sending emails can be slow, and can incur financial costs! Use appropriate handler dispatch options for async handling and rate limiting, etc.
Experimental, subject to change.

Needs `postal`, Ref. <https://github.com/drewr/postal>.

Returns a signal handler that:
  - Takes a Telemere signal (map).
  - Sends the signal as an email to specified recipient.

Useful for emailing important alerts to admins, etc.

Default handler dispatch options (override when calling `add-handler!`):
  `:min-level`  - `:info`
  `:rate-limit` -
    [[5  (enc/msecs :mins  1)] ; Max 5  emails in 1  min
     [10 (enc/msecs :mins 15)] ; Max 10 emails in 15 mins
     [15 (enc/msecs :hours 1)] ; Max 15 emails in 1  hour
     [30 (enc/msecs :hours 6)] ; Max 30 emails in 6  hours
     ]

Options:
  `:conn-opts` - Map of connection opts given to `postal/send-message`
    Examples:
      {:host "mail.isp.net",   :user "jsmith",           :pass "a-secret"},
      {:host "smtp.gmail.com", :user "jsmith@gmail.com", :pass "a-secret" :port 587 :tls true},
      {:host "email-smtp.us-east-1.amazonaws.com", :port 587, :tls true,
       :user "AKIAIDTP........", :pass "AikCFhx1P......."}

  `:msg-opts` - Map of message opts given to `postal/send-message`
    Examples:
      {:from "foo@example.com",        :to "bar@example.com"},
      {:from "Alice <foo@example.com", :to "Bob <bar@example.com>"},
      {:from "no-reply@example.com",   :to ["first-responders@example.com",
                                              "devops@example.com"],
       :cc "engineering@example.com"
       :X-MyHeader "A custom header"}

  `:subject-fn` - (fn [signal]) => email subject string
  `:body-fn`    - (fn [signal]) => email body content string,
                    see `format-signal-fn` or `pr-signal-fn`

Tips:
  - Ref. <https://github.com/drewr/postal> for more info on `postal` options.
  - Sending emails can be slow, and can incur financial costs!
    Use appropriate handler dispatch options for async handling and rate limiting, etc.
raw docstring

signal-subject-fnclj

(signal-subject-fn)
(signal-subject-fn {:keys [max-len subject-signal-key]
                    :or {max-len 128 subject-signal-key :postal/subject}})

Experimental, subject to change. Returns a (fn format [signal]) that:

  • Takes a Telemere signal (map).
  • Returns an email subject string like: "INFO EVENT :taoensso.telemere.postal/ev-id1 - msg"
Experimental, subject to change.
Returns a (fn format [signal]) that:
  - Takes a Telemere signal (map).
  - Returns an email subject string like:
    "INFO EVENT :taoensso.telemere.postal/ev-id1 - msg"
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close