Add default headers for MIME-Version and Content-type to each outgoing message.
authorMichael Orlitzky <michael@orlitzky.com>
Mon, 25 Oct 2010 06:08:36 +0000 (02:08 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 25 Oct 2010 06:08:36 +0000 (02:08 -0400)
src/Mail.hs
src/Main.hs

index 3304d7677dd501734b027bf43158876cc6672a6e..c93a6cff2e9cc53e11e96e9b0e4c36f7733b17fd 100644 (file)
@@ -22,6 +22,10 @@ data Message = Message { headers :: [Header],
                          to      :: String }
              deriving (Eq)
 
+default_headers :: [Header]
+default_headers = ["MIME-Version: 1.0",
+                   "Content-type: text/plain; charset=UTF-8"]
+
 -- |Showing a message will print it in roughly RFC-compliant
 -- form. This form is sufficient for handing the message off to
 -- sendmail.
index 7025b4bb1544c43fe4d54ebaa92df6a1c4920970..de209899bfedfb9611b269e21e8693b00f4aa79b 100644 (file)
@@ -138,7 +138,7 @@ main = do
                       case from_address of
                         Nothing -> Nothing
                         Just fromaddr ->
-                            Just (Message { headers = [],
+                            Just (Message { headers = default_headers,
                                             body = "",
                                             subject = "",
                                             to = toaddr,