From: richard Date: Sun, 12 Jan 2003 00:41:27 +0000 (+0000) Subject: - allow additional control over the roundupdb email sending (explicit X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5af8b03dd4c71c5fcb631e69072ee620dd8c9b9b;p=roundup.git - allow additional control over the roundupdb email sending (explicit cc addresses, different from address and different nosy list property) (thanks John Rouillard) git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1436 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/CHANGES.txt b/CHANGES.txt index c27eb53..b8e070b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,6 +5,9 @@ are given with the most recent entry first. - better hyperlinking in web message texts - support setting of properties on message and file through web and email interface (thanks John Rouillard) +- allow additional control over the roundupdb email sending (explicit + cc addresses, different from address and different nosy list property) + (thanks John Rouillard) 2003-01-10 0.5.4 diff --git a/doc/customizing.txt b/doc/customizing.txt index 1251db9..3ff2f48 100644 --- a/doc/customizing.txt +++ b/doc/customizing.txt @@ -2,7 +2,7 @@ Customising Roundup =================== -:Version: $Revision: 1.68 $ +:Version: $Revision: 1.69 $ .. This document borrows from the ZopeBook section on ZPT. The original is at: http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx @@ -107,15 +107,25 @@ The configuration variables available are: The email address that e-mail sent to roundup should go to. Think of it as the tracker's personal e-mail address. -**TRACKER_WEB** - ``'http://your.tracker.url.example/'`` +**TRACKER_WEB** - ``'http://tracker.example/cgi-bin/roundup.cgi/bugs/'`` The web address that the tracker is viewable at. This will be included in - information sent to users of the tracker. The URL must include the cgi-bin - part or anything else that is required to get to the home page of the - tracker. You must include a trailing '/' in the URL. + information sent to users of the tracker. The URL **must** include the + cgi-bin part or anything else that is required to get to the home page of + the tracker. You **must** include a trailing '/' in the URL. **ADMIN_EMAIL** - ``'roundup-admin@%s'%MAIL_DOMAIN`` The email address that roundup will complain to if it runs into trouble. +**EMAIL_FROM_TAG** - ``''`` + Additional text to include in the "name" part of the ``From:`` address used + in nosy messages. If the sending user is "Foo Bar", the ``From:`` line is + usually:: + "Foo Bar" + + the EMAIL_FROM_TAG goes inside the "Foo Bar" quotes like so:: + + "Foo Bar EMAIL_FROM_TAG" + **MESSAGES_TO_AUTHOR** - ``'yes'`` or``'no'`` Send nosy messages to the author of the message. @@ -172,12 +182,22 @@ tracker is attempted.:: # The email address that mail to roundup should go to TRACKER_EMAIL = 'issue_tracker@%s'%MAIL_DOMAIN - # The web address that the tracker is viewable at - TRACKER_WEB = 'http://your.tracker.url.example/' + # The web address that the tracker is viewable at. This will be included in + # information sent to users of the tracker. The URL MUST include the cgi-bin + # part or anything else that is required to get to the home page of the + # tracker. You MUST include a trailing '/' in the URL. + TRACKER_WEB = 'http://tracker.example/cgi-bin/roundup.cgi/bugs/' # The email address that roundup will complain to if it runs into trouble ADMIN_EMAIL = 'roundup-admin@%s'%MAIL_DOMAIN + # Additional text to include in the "name" part of the From: address used + # in nosy messages. If the sending user is "Foo Bar", the From: line is + # usually: "Foo Bar" + # the EMAIL_FROM_TAG goes inside the "Foo Bar" quotes like so: + # "Foo Bar EMAIL_FROM_TAG" + EMAIL_FROM_TAG = "" + # Send nosy messages to the author of the message MESSAGES_TO_AUTHOR = 'no' # either 'yes' or 'no' @@ -208,6 +228,14 @@ tracker is attempted.:: MAIL_DEFAULT_CLASS = 'issue' # use "issue" class by default #MAIL_DEFAULT_CLASS = '' # disable (or just comment the var out) + # + # SECURITY DEFINITIONS + # + # define the Roles that a user gets when they register with the tracker + # these are a comma-separated string of role names (e.g. 'Admin,User') + NEW_WEB_USER_ROLES = 'User' + NEW_EMAIL_USER_ROLES = 'User' + Tracker Schema ============== diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py index 18505d9..7723174 100644 --- a/roundup/roundupdb.py +++ b/roundup/roundupdb.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundupdb.py,v 1.75 2002-12-11 01:52:20 richard Exp $ +# $Id: roundupdb.py,v 1.76 2003-01-12 00:41:26 richard Exp $ __doc__ = """ Extending hyperdb with types specific to issue-tracking. @@ -87,7 +87,8 @@ class IssueClass: appended to the "messages" field of the specified issue. """ - def nosymessage(self, nodeid, msgid, oldvalues): + def nosymessage(self, nodeid, msgid, oldvalues, whichnosy='nosy', + from_address=[], cc=[], bcc=[]): """Send a message to the members of an issue's nosy list. The message is sent only to users on the nosy list who are not @@ -115,8 +116,16 @@ class IssueClass: sendto.append(authid) r[authid] = 1 + # now deal with cc people. + for cc_userid in cc : + if r.has_key(cc_userid): + continue + # send it to them + sendto.append(cc_userid) + recipients.append(cc_userid) + # now figure the nosy people who weren't recipients - nosy = self.get(nodeid, 'nosy') + nosy = self.get(nodeid, whichnosy) for nosyid in nosy: # Don't send nosy mail to the anonymous user (that user # shouldn't appear in the nosy list, but just in case they @@ -144,12 +153,12 @@ class IssueClass: messages.set(msgid, recipients=recipients) # send the message - self.send_message(nodeid, msgid, note, sendto) + self.send_message(nodeid, msgid, note, sendto, from_address) # backwards compatibility - don't remove sendmessage = nosymessage - def send_message(self, nodeid, msgid, note, sendto): + def send_message(self, nodeid, msgid, note, sendto, from_address=None): '''Actually send the nominated message from this node to the sendto recipients, with the note appended. ''' @@ -220,16 +229,23 @@ class IssueClass: # make sure the To line is always the same (for testing mostly) sendto.sort() + # make sure we have a from address + if from_address is None: + from_address = self.db.config.TRACKER_EMAIL + + # additional bit for after the From: "name" + from_tag = getattr(self.db.config, 'EMAIL_FROM_TAG', '') + if from_tag: + from_tag = ' ' + from_tag + # create the message message = cStringIO.StringIO() writer = MimeWriter.MimeWriter(message) writer.addheader('Subject', '[%s%s] %s'%(cn, nodeid, title)) writer.addheader('To', ', '.join(sendto)) - writer.addheader('From', straddr( - (authname, self.db.config.TRACKER_EMAIL) ) ) - writer.addheader('Reply-To', straddr( - (self.db.config.TRACKER_NAME, - self.db.config.TRACKER_EMAIL) ) ) + writer.addheader('From', straddr((authname + from_tag, from_address))) + writer.addheader('Reply-To', straddr((self.db.config.TRACKER_NAME, + from_address))) writer.addheader('Date', time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime())) writer.addheader('MIME-Version', '1.0') @@ -282,7 +298,7 @@ class IssueClass: # now try to send the message if SENDMAILDEBUG: - open(SENDMAILDEBUG, 'w').write('FROM: %s\nTO: %s\n%s\n'%( + open(SENDMAILDEBUG, 'a').write('FROM: %s\nTO: %s\n%s\n'%( self.db.config.ADMIN_EMAIL, ', '.join(sendto),message.getvalue())) else: diff --git a/roundup/templates/classic/config.py b/roundup/templates/classic/config.py index 9e9545e..ceb6235 100644 --- a/roundup/templates/classic/config.py +++ b/roundup/templates/classic/config.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: config.py,v 1.6 2002-12-13 22:20:10 richard Exp $ +# $Id: config.py,v 1.7 2003-01-12 00:41:27 richard Exp $ import os @@ -49,13 +49,13 @@ TRACKER_WEB = 'http://tracker.example/cgi-bin/roundup.cgi/bugs/' # The email address that roundup will complain to if it runs into trouble ADMIN_EMAIL = 'roundup-admin@%s'%MAIL_DOMAIN -# -# SECURITY DEFINITIONS -# -# define the Roles that a user gets when they register with the tracker -# these are a comma-separated string of role names (e.g. 'Admin,User') -NEW_WEB_USER_ROLES = 'User' -NEW_EMAIL_USER_ROLES = 'User' +# Additional text to include in the "name" part of the From: address used +# in nosy messages. If the sending user is "Foo Bar", the From: line is +# usually: +# "Foo Bar" +# the EMAIL_FROM_TAG goes inside the "Foo Bar" quotes like so: +# "Foo Bar EMAIL_FROM_TAG" +EMAIL_FROM_TAG = "" # Send nosy messages to the author of the message MESSAGES_TO_AUTHOR = 'no' # either 'yes' or 'no' @@ -89,4 +89,12 @@ EMAIL_LEAVE_BODY_UNCHANGED = 'no' # either 'yes' or 'no' MAIL_DEFAULT_CLASS = 'issue' # use "issue" class by default #MAIL_DEFAULT_CLASS = '' # disable (or just comment the var out) +# +# SECURITY DEFINITIONS +# +# define the Roles that a user gets when they register with the tracker +# these are a comma-separated string of role names (e.g. 'Admin,User') +NEW_WEB_USER_ROLES = 'User' +NEW_EMAIL_USER_ROLES = 'User' + # vim: set filetype=python ts=4 sw=4 et si diff --git a/roundup/templates/minimal/config.py b/roundup/templates/minimal/config.py index 9bebe11..f047fa1 100644 --- a/roundup/templates/minimal/config.py +++ b/roundup/templates/minimal/config.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: config.py,v 1.4 2002-12-13 22:20:10 richard Exp $ +# $Id: config.py,v 1.5 2003-01-12 00:41:27 richard Exp $ import os @@ -49,6 +49,13 @@ TRACKER_WEB = 'http://tracker.example/cgi-bin/roundup.cgi/bugs/' # The email address that roundup will complain to if it runs into trouble ADMIN_EMAIL = 'roundup-admin@%s'%MAIL_DOMAIN +# Additional text to include in the "name" part of the From: address used +# in nosy messages. If the sending user is "Foo Bar", the From: line is +# usually: "Foo Bar" +# the EMAIL_FROM_TAG goes inside the "Foo Bar" quotes like so: +# "Foo Bar EMAIL_FROM_TAG" +EMAIL_FROM_TAG = "" + # # SECURITY DEFINITIONS #