Don't forget the date\!
[cocanwiki.git] / scripts / contact.ml
index 23dd68b..ba468af 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: contact.ml,v 1.12 2006/07/31 09:10:33 rich Exp $
+ * $Id: contact.ml,v 1.14 2006/12/06 09:46:56 rich Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -33,11 +33,12 @@ open Cocanwiki_ok
 let subj_rex = Pcre.regexp "\\$\\w+"
 
 let run r (q : cgi) dbh hostid {hostname = hostname} user =
-  let template = get_template dbh hostid "contact.txt" in
+  let template = get_template dbh hostid "contact.txt" in
 
   let fail msg =
     error ~back_button:true ~title:"Bad form"
-      dbh hostid q (msg ^ "  Please contact the owner of the site by email.");
+      r dbh hostid q
+      (msg ^ "  Please contact the owner of the site by email.");
     return ()
   in
 
@@ -148,8 +149,10 @@ let run r (q : cgi) dbh hostid {hostname = hostname} user =
   template#set "nr_uploads" (string_of_int (List.length uploads));
 
   (* Send the initial email. *)
+  let content_type =
+    "text/plain", ["charset", Mimestring.mk_param "UTF-8"] in
   let body = template#to_string in
-  let msg = Netsendmail.compose ~to_addrs ~subject body in
+  let msg = Netsendmail.compose ~to_addrs ~subject ~content_type body in
   Netsendmail.sendmail msg;
 
   (* Send the following uploads by email. *)
@@ -166,7 +169,7 @@ let run r (q : cgi) dbh hostid {hostname = hostname} user =
 
   (* Confirm. *)
   ok ~title:"Thank you for your contact" ~buttons:[ok_button "/"]
-    dbh hostid q "An email was sent and you should receive a reply shortly."
+    dbh hostid q "An email was sent and you should receive a reply shortly."
 
 let () =
   register_script ~restrict:[CanView] run