 (defn sender [msg]
   (or (:sender msg) (:from msg)))
 
+(defn make-address [addr]
+  (try
+    (InternetAddress. addr)
+    (catch Exception _)))
+
 (defn message->str [msg]
   (with-open [out (java.io.ByteArrayOutputStream.)]
     (let [jmsg (if (instance? MimeMessage msg) msg (make-jmessage msg))]

    (is (re-find #"User-Agent: Lorem Ipsum" (message->str m)))))

(deftest test-bad-addrs
  (let [m {:from "foo@bar.dom"
           :to "badddz@@@bar.dom"
           :subject "Test"
           :body "Bad recipient!"}]
    (is (not (re-find #"badddz" (message->str m))))))

      (str out))))

(defn add-recipient! [jmsg rtype addr]
  (if-let [addr (make-address addr)]
    (doto jmsg
      (.addRecipient rtype addr))
    jmsg))

(defn add-recipients! [jmsg rtype addrs]
  (when addrs
