(* 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.13 2006/07/31 09:49:42 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
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. *)
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: crash.ml,v 1.5 2006/03/27 18:09:46 rich Exp $
+ * $Id: crash.ml,v 1.6 2006/07/31 09:49:42 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
let crash_email = server_settings_crash_email dbh in
(* Get the current time and write it into the logs. *)
- let time = Unix.gmtime (Unix.time ()) in
- let time =
- sprintf "%04d/%02d/%02d %02d:%02d:%02d"
- (time.Unix.tm_year + 1900) (time.Unix.tm_mon + 1) time.Unix.tm_mday
- time.Unix.tm_hour time.Unix.tm_min time.Unix.tm_sec in
-
+ let time = Calendar.now () in
+ let time = Printer.CalendarPrinter.to_string time in
prerr_endline ("crash: " ^ time);
(* Send a feedback email to the designated address if
*)
let mail_sent =
match crash_email with
- None -> false
- | Some email ->
- let subject =
- "Crash notify: There was a 500 internal server error" in
- let body = "Crash at " ^ time ^ "\n" ^
- "Hostname is " ^ canonical_hostname ^ "\n" ^
- "Please see the error log for details." in
- Sendmail.send_mail ~subject ~to_addr:[email] body;
+ | None -> false
+ | Some email ->
+ let subject =
+ "Crash notify: There was a 500 internal server error" in
+ let body = "Crash at " ^ time ^ "\n" ^
+ "Hostname is " ^ canonical_hostname ^ "\n" ^
+ "Please see the error log for details." in
+
+ let to_addrs = ["", email] in
+ let content_type =
+ "text/plain", ["charset", Mimestring.mk_param "UTF-8"] in
+
+ let msg =
+ Netsendmail.compose ~subject ~to_addrs ~content_type body in
+ Netsendmail.sendmail msg;
- true in
+ true in
template#conditional "mail_sent" mail_sent;
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: edit.ml,v 1.31 2006/07/27 16:46:55 rich Exp $
+ * $Id: edit.ml,v 1.32 2006/07/31 09:49:42 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
let subject =
"Site notice: " ^ hostname ^ "/" ^ url ^ " has been updated" in
+ let content_type =
+ "text/plain", ["charset", Mimestring.mk_param "UTF-8"] in
+
(* Send each email individually (they all have different opt out
* links).
*)
List.iter (fun (to_addr, opt_out) ->
template_email#set "opt_out" opt_out;
let body = template_email#to_string in
- Sendmail.send_mail ~subject
- ~to_addr:[to_addr] body)
+
+ let msg = Netsendmail.compose ~to_addrs:["", to_addr]
+ ~subject ~content_type body in
+ Netsendmail.sendmail msg)
addrs
);
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: forgot_password.ml,v 1.10 2006/03/27 19:10:29 rich Exp $
+ * $Id: forgot_password.ml,v 1.11 2006/07/31 09:49:43 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
"\n" ^
"IP address of request: " ^ ip ^ "\n" in
- Sendmail.send_mail ~subject ~to_addr:[ email ] body;
+ let content_type =
+ "text/plain", ["charset", Mimestring.mk_param "UTF-8"] in
+ let to_addrs = [ "", email ] in
+
+ let msg = Netsendmail.compose ~subject ~to_addrs ~content_type body in
+ Netsendmail.sendmail msg;
let buttons = [ ok_button "/_login" ] in
ok ~buttons ~title:"Password sent by email"
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: invite_user.ml,v 1.8 2006/07/26 13:12:10 rich Exp $
+ * $Id: invite_user.ml,v 1.9 2006/07/31 09:49:43 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
let subject = username ^ " has invited you to join " ^ hostname in
(* Get a suitable return address for the email. *)
- let from =
+ let from_addr =
match email with
- | Some email -> email
- | None -> "service@merjis.com" in
+ | Some email -> username, email
+ | None -> username, "service@merjis.com" in
(* Add user accounts for these new users. For users who are already
* registered, we'll send reminder emails.
| _ -> assert false in
(* Send the email. *)
- Sendmail.send_mail ~subject ~to_addr:[email] ~from body
+ let to_addrs = [ "", email ] in
+ let content_type =
+ "text/plain", ["charset", Mimestring.mk_param "UTF-8"] in
+
+ let msg =
+ Netsendmail.compose ~subject
+ ~to_addrs ~from_addr ~content_type body in
+ Netsendmail.sendmail msg
) emails;
(* Finish off. *)
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: invite_user_confirm.ml,v 1.7 2006/03/28 16:24:07 rich Exp $
+ * $Id: invite_user_confirm.ml,v 1.8 2006/07/31 09:49:43 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
let body = template#to_string in
let subject = "Your new account details" in
- Sendmail.send_mail ~to_addr:[email] ~subject body);
+
+ let to_addrs = [ "", email ] in
+ let content_type =
+ "text/plain", ["charset", Mimestring.mk_param "UTF-8"] in
+
+ let msg = Netsendmail.compose ~to_addrs ~subject ~content_type body in
+ Netsendmail.sendmail msg);
PGOCaml.commit dbh;
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: cocanwiki_emailnotify.ml,v 1.8 2006/04/08 14:46:24 rich Exp $
+ * $Id: cocanwiki_emailnotify.ml,v 1.9 2006/07/31 09:49:45 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
*
* Also get the user's email address.
*)
- let own_userid, from =
+ let own_userid, from_addr =
match user with
| None
| Some Anonymous -> 0l, None
- | Some (User (userid, _, _, prefs)) -> userid, prefs.email in
+ | Some (User (userid, _, _, {email = Some email})) ->
+ userid, Some ("", email)
+ | Some (User (userid, _, _, _)) ->
+ userid, None in
(* Send a change email to everyone who hasn't opted out using
* their preferences. This behaviour replaces the old
from users
where hostid = $hostid and id <> $own_userid and email_notify
and email is not null and invite is null" in
- let to_addr = List.filter_map (
+ let to_addrs = List.filter_map (
function
| (name, Some email) ->
- Some ("\"" ^ name ^ "\" <" ^ email ^ ">")
+ Some (name, email)
| (name, None) -> None
) rows in
"select canonical_hostname from hosts where id = $hostid"
) in
- if to_addr <> [] then (
+ if to_addrs <> [] then (
(* Prepare the body of the message. The assumption is that
* this takes time and database access, so we defer the creation
* of the body until we know that someone needs to be notified.
let subject = canonical_hostname ^ ": " ^ subject in
+ let content_type =
+ "text/plain", ["charset", Mimestring.mk_param "UTF-8"] in
+
(* Send the email. *)
- Sendmail.send_mail ~subject ~to_addr ?from body
+ let msg =
+ Netsendmail.compose ~to_addrs ?from_addr ~content_type ~subject body in
+ Netsendmail.sendmail msg
)
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: mailing_list_send.ml,v 1.8 2006/03/28 13:20:00 rich Exp $
+ * $Id: mailing_list_send.ml,v 1.9 2006/07/31 09:49:43 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
let body = template#to_string in
let subject = "Site notice: " ^ hostname ^ ": Confirm your email address" in
- Sendmail.send_mail ~subject ~to_addr:[email] body;
+
+ let content_type =
+ "text/plain", ["charset", Mimestring.mk_param "UTF-8"] in
+ let to_addrs = [ "", email ] in
+
+ let msg = Netsendmail.compose ~subject ~to_addrs ~content_type body in
+ Netsendmail.sendmail msg;
(* Finish up. *)
let buttons = [ ok_button "/" ] in
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: page_email_send.ml,v 1.6 2006/03/28 16:24:07 rich Exp $
+ * $Id: page_email_send.ml,v 1.7 2006/07/31 09:49:43 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
let body = template#to_string in
let subject = "Site notice: " ^ hostname ^ ": Confirm your email address" in
- Sendmail.send_mail ~subject ~to_addr:[email] body;
+
+ let content_type =
+ "text/plain", ["charset", Mimestring.mk_param "UTF-8"] in
+ let to_addrs = [ "", email ] in
+
+ let msg = Netsendmail.compose ~subject ~to_addrs ~content_type body in
+ Netsendmail.sendmail msg;
(* Finish up. *)
let buttons = [ ok_button ("/" ^ page) ] in
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: send_feedback.ml,v 1.9 2006/07/26 13:12:10 rich Exp $
+ * $Id: send_feedback.ml,v 1.10 2006/07/31 09:49:43 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
(* Send the feedback email. *)
let subject = "Wiki feedback: Feedback about " ^ page ^ " page" in
let body = template#to_string in
- Sendmail.send_mail ~subject ~to_addr:[to_addr] body;
+
+ let to_addrs = [ "", to_addr ] in
+ let content_type =
+ "text/plain", ["charset", Mimestring.mk_param "UTF-8"] in
+
+ let msg = Netsendmail.compose ~subject ~to_addrs ~content_type body in
+ Netsendmail.sendmail msg;
(* Confirm. *)
ok ~title:"Thank you for your feedback" ~buttons:[ok_button "/"]
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: user_prefs.ml,v 1.8 2006/03/28 16:24:08 rich Exp $
+ * $Id: user_prefs.ml,v 1.9 2006/07/31 09:49:43 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
let body = email_change_template#to_string in
let subject = "Please verify your new email address at " ^ hostname in
- Sendmail.send_mail ~subject ~to_addr:[new_email] body
+
+ let content_type =
+ "text/plain", ["charset", Mimestring.mk_param "UTF-8"] in
+ let to_addrs = [ "", new_email ] in
+
+ let msg = Netsendmail.compose ~subject ~to_addrs ~content_type body in
+ Netsendmail.sendmail msg
);
changed