Minor changes on email sending internals.

This commit is contained in:
Andrey Antukh 2021-01-19 11:30:40 +01:00 committed by Alonso Torres
parent af310854fc
commit b7a90eb4e4
2 changed files with 7 additions and 7 deletions

View file

@ -5,7 +5,7 @@
;; This Source Code Form is "Incompatible With Secondary Licenses", as ;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0. ;; defined by the Mozilla Public License, v. 2.0.
;; ;;
;; Copyright (c) 2020 UXBOX Labs SL ;; Copyright (c) 2020-2021 UXBOX Labs SL
(ns app.tasks.sendmail (ns app.tasks.sendmail
(:require (:require

View file

@ -91,8 +91,8 @@
^String charset)) ^String charset))
(defn- assign-extra-headers (defn- assign-extra-headers
[^MimeMessage mmsg {:keys [headers custom-data] :as params}] [^MimeMessage mmsg {:keys [headers extra-data] :as params}]
(let [headers (assoc headers "X-Sereno-Custom-Data" custom-data)] (let [headers (assoc headers "X-Penpot-Data" extra-data)]
(reduce-kv (fn [^MimeMessage mmsg k v] (reduce-kv (fn [^MimeMessage mmsg k v]
(doto mmsg (doto mmsg
(.addHeader (name k) (str v)))) (.addHeader (name k) (str v))))
@ -223,11 +223,11 @@
(s/def ::from ::us/email) (s/def ::from ::us/email)
(s/def ::reply-to ::us/email) (s/def ::reply-to ::us/email)
(s/def ::lang string?) (s/def ::lang string?)
(s/def ::custom-data ::us/string) (s/def ::extra-data ::us/string)
(s/def ::context (s/def ::context
(s/keys :req-un [::to] (s/keys :req-un [::to]
:opt-un [::reply-to ::from ::lang ::priority ::custom-data])) :opt-un [::reply-to ::from ::lang ::priority ::extra-data]))
(defn template-factory (defn template-factory
([id] (template-factory id {})) ([id] (template-factory id {}))
@ -249,8 +249,8 @@
:hint "seems like the template is wrong or does not exists." :hint "seems like the template is wrong or does not exists."
:context {:id id})) :context {:id id}))
(cond-> (assoc email :id (name id)) (cond-> (assoc email :id (name id))
(:custom-data context) (:extra-data context)
(assoc :custom-data (:custom-data context)) (assoc :extra-data (:extra-data context))
(:from context) (:from context)
(assoc :from (:from context)) (assoc :from (:from context))