Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46344044e9 | ||
|
|
da0d8c07ca | ||
|
|
0e5e981e79 | ||
|
|
81d0b9e947 | ||
|
|
6d511ba330 | ||
|
|
271ea0470b | ||
|
|
a0adf79420 | ||
|
|
b82a252bbe |
17
config.yaml
17
config.yaml
@@ -1,9 +1,12 @@
|
|||||||
domain: "http://localhost"
|
domain: "domain.com"
|
||||||
|
domain-cli: "domain.com"
|
||||||
debug: true
|
debug: true
|
||||||
port: 7404
|
port: 7404
|
||||||
smtp-from: "api2smtp <no-reply@www.tadam-framework.dev>"
|
smtp-from: "no-reply@domain.com"
|
||||||
smtp-host: localhost
|
smtp-to: "my@domain.com"
|
||||||
smtp-user:
|
smtp-subject: "Contact"
|
||||||
smtp-pass:
|
smtp-host: "smtp.domain.com"
|
||||||
smtp-ssl: false
|
smtp-user: ""
|
||||||
smtp-port: 1025
|
smtp-password: ""
|
||||||
|
smtp-port: 587
|
||||||
|
smtp-tls: true
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
(defproject api2smtp "1.0.0"
|
(defproject api2smtp "1.0.5"
|
||||||
:description "Send emails through an Endpoint API"
|
:description "Send emails through an Endpoint API"
|
||||||
:url "https://github.com/tanrax/api2smtp"
|
:url "https://github.com/tanrax/api2smtp"
|
||||||
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
|
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
:dependencies [;; Clojure
|
:dependencies [;; Clojure
|
||||||
[org.clojure/clojure "1.10.1"]
|
[org.clojure/clojure "1.10.1"]
|
||||||
;; Tadam core
|
;; Tadam core
|
||||||
[tadam-core "0.4.0"]
|
[tadam-core "0.4.2"]
|
||||||
;; HTTP Server
|
;; HTTP Server
|
||||||
[ring "1.8.0"]
|
[ring "1.8.0"]
|
||||||
;; Ring middleware that prevents CSRF attacks
|
;; Ring middleware that prevents CSRF attacks
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
(-> all-routes
|
(-> all-routes
|
||||||
(wrap-defaults (assoc-in site-defaults [:security :anti-forgery] false))
|
(wrap-defaults (assoc-in site-defaults [:security :anti-forgery] false))
|
||||||
(wrap-cors
|
(wrap-cors
|
||||||
:access-control-allow-origin [(re-pattern (if (config :debug) ".*" (config :domain)))]
|
:access-control-allow-origin [(re-pattern (if (config :debug) ".*" (config :domain-cli)))]
|
||||||
:access-control-allow-methods [:get])
|
:access-control-allow-methods [:get :post])
|
||||||
(#(if (config :debug) (wrap-reload %) %))))
|
(#(if (config :debug) (wrap-reload %) %))))
|
||||||
|
|
||||||
(defn -main [& args]
|
(defn -main [& args]
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
:email (-> json :email)
|
:email (-> json :email)
|
||||||
:message (-> json :message)}]
|
:message (-> json :message)}]
|
||||||
;; Send email
|
;; Send email
|
||||||
(send config "to@email.com" "Contact" (render-template "emails/contact.html" params) (render-template "emails/contact.txt" params))
|
(send config (:smtp-to config) (:smtp-subject config) (render-template "emails/contact.html" params) (render-template "emails/contact.txt" params))
|
||||||
|
|
||||||
;; Response OK
|
;; Response OK
|
||||||
(render-JSON req {:status "ok"})))
|
(render-JSON req {:status "ok"})))
|
||||||
|
|||||||
Reference in New Issue
Block a user