 
 
 (defn make-attachment [filename data]
-  (MailService$Attachment. filename data))
+  (MailService$Attachment. filename (if (instance? (class (.getBytes "")) data)
+                                        data
+                                        (.getBytes data))))
 
 
 (defn make-message [& {:keys [from to subject text-body html-body

  (.sendToAdmins (get-mail-service) (make-mail-service-message msg)))


(defn parse-message [request]
  (let [session (javax.mail.Session/getDefaultInstance (java.util.Properties.) nil)
        raw-msg (javax.mail.internet.MimeMessage. session (.getInputStream (:request request)))

(ns appengine-magic.services.mail
  (:refer-clojure :exclude (send))
  (:use [appengine-magic.utils :only [record copy-stream]])
  (:import [com.google.appengine.api.mail MailServiceFactory
            MailService$Message MailService$Attachment]))

