(* 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.7 2006/03/27 16:43:44 rich Exp $
+ * $Id: cocanwiki_emailnotify.ml,v 1.8 2006/04/08 14:46:24 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
| (name, None) -> None
) rows in
+ (* Get the canonical hostname. *)
+ let canonical_hostname = List.hd (
+ PGSQL(dbh)
+ "select canonical_hostname from hosts where id = $hostid"
+ ) in
+
if to_addr <> [] then (
(* Prepare the body of the message. The assumption is that
* this takes time and database access, so we defer the creation
*)
let body = body () in
- let subject = "Site notice: " ^ subject in
+ (* Add the opt-out signature to the body. *)
+ let body = body ^ "\n\n-- \n" ^
+ "To stop receiving further emails:\n" ^
+ "(1) Go to http://" ^ canonical_hostname ^ "/_userprefs\n" ^
+ "(2) Uncheck 'Receive email notifications'\n" ^
+ "(3) Press 'Update Preferences'\n" in
+
+ let subject = canonical_hostname ^ ": " ^ subject in
(* Send the email. *)
Sendmail.send_mail ~subject ~to_addr ?from body