<commit_before>(ns com.draines.postal.core
  (:use [com.draines.postal.sendmail :only [sendmail-send]]
        [com.draines.postal.smtp :only [smtp-send]]))

(defn send-message [msg]
  (when-not (and (:from msg)
                 (:to msg)
                 (:subject msg)
                 (:body msg))
    (throw (Exception.
            "message needs at least :from, :to, :subject, and :body")))
  (if (:host (meta msg))
    (smtp-send msg)
    (sendmail-send msg)))
<commit_msg>Add core helper for stress/spam.<commit_after>(ns com.draines.postal.core
  (:use [com.draines.postal.sendmail :only [sendmail-send]]
        [com.draines.postal.smtp :only [smtp-send]]
        [com.draines.postal.stress :only [spam]]))

(defn send-message [msg]
  (when-not (and (:from msg)
                 (:to msg)
                 (:subject msg)
                 (:body msg))
    (throw (Exception.
            "message needs at least :from, :to, :subject, and :body")))
  (if (:host (meta msg))
    (smtp-send msg)
    (sendmail-send msg)))

(defn stress [profile]
  (let [defaults {:host "localhost"
                  :port 25
                  :from "<EMAIL>"
                  :to "<EMAIL>"
                  :num 1
                  :delay 100
                  :threads 1}
        {:keys [host port from to num delay threads]}
        (merge defaults profile)]
    (println (format "sent %s msgs to %s:%s"
                     (spam host port from to num delay threads)
                     host port))))
{'fraction_non_alphanumeric': 0.14190093708165996, 'fraction_numerical': 0.004685408299866131, 'mean_word_length': 1.799625468164794, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6628318', 'n_tokens_mistral': 496, 'n_tokens_neox': 460, 'n_words': 136}