From 262f6a0c34949247ba6b78399b787e693da38d86 Mon Sep 17 00:00:00 2001 From: rich Date: Sat, 8 Apr 2006 14:46:24 +0000 Subject: [PATCH] Change subject line so it shows the name of the site. Add an message which shows how to unsubscribe from messages. --- scripts/lib/cocanwiki_emailnotify.ml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/lib/cocanwiki_emailnotify.ml b/scripts/lib/cocanwiki_emailnotify.ml index c63b846..3214460 100644 --- a/scripts/lib/cocanwiki_emailnotify.ml +++ b/scripts/lib/cocanwiki_emailnotify.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * 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 @@ -62,6 +62,12 @@ let email_notify ~subject ~body ?user dbh hostid = | (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 @@ -69,7 +75,14 @@ let email_notify ~subject ~body ?user dbh hostid = *) 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 -- 1.8.3.1