0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-25 07:58:49 -05:00

🐛 Fix sendmail to console unexpected exception.

This commit is contained in:
Andrey Antukh 2020-11-11 13:34:06 +01:00
parent c3ca59ac93
commit ef01caf829
2 changed files with 10 additions and 9 deletions

View file

@ -37,7 +37,7 @@
:image-process-max-threads 2
:smtp-enable false
:smtp-enabled false
:smtp-default-reply-to "no-reply@example.com"
:smtp-default-from "no-reply@example.com"
@ -79,7 +79,7 @@
(s/def ::media-uri ::us/string)
(s/def ::media-directory ::us/string)
(s/def ::secret-key ::us/string)
(s/def ::smtp-enable ::us/boolean)
(s/def ::smtp-enabled ::us/boolean)
(s/def ::smtp-default-reply-to ::us/email)
(s/def ::smtp-default-from ::us/email)
(s/def ::smtp-host ::us/string)
@ -138,7 +138,7 @@
::secret-key
::smtp-default-from
::smtp-default-reply-to
::smtp-enable
::smtp-enabled
::smtp-host
::smtp-port
::smtp-username
@ -205,6 +205,7 @@
:default-reply-to (:smtp-default-reply-to cfg)
:default-from (:smtp-default-from cfg)
:tls (:smtp-tls cfg)
:enabled (:smtp-enabled cfg)
:username (:smtp-username cfg)
:password (:smtp-password cfg)})

View file

@ -17,9 +17,9 @@
[app.metrics :as mtx]))
(defn- send-console!
[cfg email]
[config email]
(let [baos (java.io.ByteArrayOutputStream.)
mesg (emails/smtp-message cfg email)]
mesg (emails/smtp-message config email)]
(.writeTo mesg baos)
(let [out (with-out-str
(println "email console dump:")
@ -31,10 +31,10 @@
(defn handler
{:app.tasks/name "sendmail"}
[{:keys [props] :as task}]
(if (:smtp-enable cfg/config)
(-> (cfg/smtp cfg/config)
(emails/send! props))
(send-console! props)))
(let [config (cfg/smtp cfg/config)]
(if (:enabled config)
(emails/send! config props)
(send-console! config props))))
(mtx/instrument-with-summary!
{:var #'handler