<commit_before>(ns servisne-info.notifications
  (:use postal.core)
  (:require [environ.core :refer [env]]
            [servisne-info.event :as event]
            [servisne-info.views.email :as email]))

(def default-from "<EMAIL>")

(defn send-email
  [to subject body]
  (send-message {:host (env :email-host)
                 :user (env :email-user) 
                 :pass (env :email-pass)
                 :port 587}
                {:from default-from
                 :to to
                 :subject subject
                 :body body}))

(defn send-news-email [user news]
  (event/record "Sending news email" {:user (:email user)})
  (send-email (:email user)
              "Servisne informacije"
              (email/render "new_links.txt"
                            {:links (map :url news)})))

(defn send-test-email []
  (send-email "<EMAIL>"
              "Test poruka"
              (email/render "new_links.txt"
                            {:links ["http://servisne.info/" "http://servisne.info/about"]})))<commit_msg>Remove test email<commit_after>(ns servisne-info.notifications
  (:use postal.core)
  (:require [environ.core :refer [env]]
            [servisne-info.event :as event]
            [servisne-info.views.email :as email]))

(def default-from "<EMAIL>")

(defn send-email
  [to subject body]
  (send-message {:host (env :email-host)
                 :user (env :email-user) 
                 :pass (env :email-pass)
                 :port 587}
                {:from default-from
                 :to to
                 :subject subject
                 :body body}))

(defn send-news-email [user news]
  (event/record "Sending news email" {:user (:email user)})
  (send-email (:email user)
              "Servisne informacije"
              (email/render "new_links.txt"
                            {:links (map :url news)})))
{'fraction_non_alphanumeric': 0.13756045137023107, 'fraction_numerical': 0.0032240730789897904, 'mean_word_length': 1.7182481751824819, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3293674', 'n_tokens_mistral': 577, 'n_tokens_neox': 555, 'n_words': 140}