       (hiccup-to-plain-text email-hiccup)
       (hiccup/html email-hiccup))))
 
+; curl -X POST -s "https://pol.is/api/v3/sendEmailExportReady"
+;   -d "conversation_id=9isb32"
+;   -d "filename=polis-export-9isb32-1472680904264.zip"
+;   -d "webserver_username=$WEBSERVER_USERNAME"
+;   -d "webserver_pass=$WEBSERVER_PASS"
+;   -d "uid=125"
+
+(defn send-email-notification-via-polis-api!
+  [filename {:keys [zinvite email]}]
+  (client/post "https://pol.is/api/v3/sendEmailExportReady"
+               {:query-params {:webserver_username (:webserver-username env/env)
+                               :webserver_pass (:webserver-pass env/env)
+                               :email email
+                               :filename filename
+                               :conversation_id zinvite}}))
+
 (defn handle-completion!
   [aws-cred filename params]
   (log/info "Completed export computation for filename" filename "params:" (with-out-str (str params)))
   (upload-to-aws aws-cred filename)
   (notify-mongo filename "complete" params)
-  (when (:email params) (send-email-notification! filename params)))
+  (when (:email params) (send-email-notification-via-polis-api! filename params)))
+  ;(when (:email params) (send-email-notification-via-mailgun! filename params)))
 
 (defn handle-timedout-datadump!
   [aws-cred filename compute-chan params]

            [clojure.tools.logging :as log]
            [clj-time.core :as time]
            [bidi.bidi :as bidi]
            [bidi.ring]))


;; First we'll just set up some basic helpers and settings/variables we'll need.


  (-> (client/post "http://localhost:3000/ping" {:form-params {:q "foo, bar"}})
      (dissoc :body)
      clojure.pprint/pprint))



;; TODO / Thoughts
