From c40d9d9a7c8dec989277f5b8f42bf9587a3a6b4c Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 6 Apr 2021 23:25:50 +0200 Subject: [PATCH] :fire: Remove unused code. --- backend/src/app/tasks/sendmail.clj | 58 ------------------------------ 1 file changed, 58 deletions(-) delete mode 100644 backend/src/app/tasks/sendmail.clj diff --git a/backend/src/app/tasks/sendmail.clj b/backend/src/app/tasks/sendmail.clj deleted file mode 100644 index 333f7efd1..000000000 --- a/backend/src/app/tasks/sendmail.clj +++ /dev/null @@ -1,58 +0,0 @@ -;; This Source Code Form is subject to the terms of the Mozilla Public -;; License, v. 2.0. If a copy of the MPL was not distributed with this -;; file, You can obtain one at http://mozilla.org/MPL/2.0/. -;; -;; This Source Code Form is "Incompatible With Secondary Licenses", as -;; defined by the Mozilla Public License, v. 2.0. -;; -;; Copyright (c) UXBOX Labs SL - -(ns app.tasks.sendmail - (:require - [app.config :as cfg] - [app.util.emails :as emails] - [clojure.spec.alpha :as s] - [clojure.tools.logging :as log] - [integrant.core :as ig])) - -(declare send-console!) - -(s/def ::username ::cfg/smtp-username) -(s/def ::password ::cfg/smtp-password) -(s/def ::tls ::cfg/smtp-tls) -(s/def ::ssl ::cfg/smtp-ssl) -(s/def ::host ::cfg/smtp-host) -(s/def ::port ::cfg/smtp-port) -(s/def ::default-reply-to ::cfg/smtp-default-reply-to) -(s/def ::default-from ::cfg/smtp-default-from) -(s/def ::enabled ::cfg/smtp-enabled) - -(defmethod ig/pre-init-spec ::handler [_] - (s/keys :req-un [::enabled] - :opt-un [::username - ::password - ::tls - ::ssl - ::host - ::port - ::default-from - ::default-reply-to])) - -(defmethod ig/init-key ::handler - [_ cfg] - (fn [{:keys [props] :as task}] - (if (:enabled cfg) - (emails/send! cfg props) - (send-console! cfg props)))) - -(defn- send-console! - [cfg email] - (let [baos (java.io.ByteArrayOutputStream.) - mesg (emails/smtp-message cfg email)] - (.writeTo mesg baos) - (let [out (with-out-str - (println "email console dump:") - (println "******** start email" (:id email) "**********") - (println (.toString baos)) - (println "******** end email "(:id email) "**********"))] - (log/info out))))