
jbogden at sandia
Nov 22, 2006, 11:07 AM
Post #3 of 3
(747 views)
Permalink
|
|
Re: modifying ticket notification email behavior
[In reply to]
|
|
Thank you! This was just what I needed. For the record, I'm trying to use a Sourceforge mailing list to capture all Trac ticket activity and their lists are very picky about how emails are sent. A custom patch is currently required to trac/notification.py to get TRAC to work with Sourceforge lists (at least for me). The final patch I ended up using is: --- site-packages/trac/notification.py.orig 2006-11-02 13:15:09.000000000 -0700 +++ site-packages/trac/notification.py 2006-11-22 09:54:38.000000000 -0700 @@ -298,7 +298,8 @@ headers['X-Trac-Project'] = projname headers['X-URL'] = self.config.get('project', 'url') headers['Subject'] = self.subject - headers['From'] = (projname, self.from_email) + #headers['From'] = (projname, self.from_email) + headers['From'] = (self.from_email) headers['Sender'] = self.from_email headers['Reply-To'] = self.replyto_email @@ -316,8 +317,10 @@ all.append(rcpt) return (tmp, all) - toaddrs = build_addresses(torcpts) - ccaddrs = build_addresses(ccrcpts) + toaddrs = [] + toaddrs.append(u'YOUR-LIST[at]lists.sourceforge.net') + #toaddrs = build_addresses(torcpts) + ccaddrs = build_addresses(torcpts + ccrcpts) accparam = self.config.get('notification', 'smtp_always_cc') accaddrs = accparam and \ build_addresses(accparam.replace(',', ' ').split()) or [] > > Is there a way to add an email address that will always be > in the TO address list? > No > > > I don't see any config options to that effect. I looked at > the code in > > /usr/lib/python2.3/site-packages/trac/notification.py > (version 0.10.1) > > and don't quite see where I could hack in an address. > > In this file, line ~320, you could either push the cclist into the > "to" recipient list rather than in the cc list (which means that all > recipients declared in smtp_always_cc would be sent as "to" rather > than "cc"): > > > Index: trac/notification.py > =================================================================== > --- trac/notification.py (revision 4188) > +++ trac/notification.py (working copy) > @@ -326,16 +326,15 @@ > build_addresses(bccparam.replace(',', ' > ').split()) or [] > > recipients = [] > - (toaddrs, recipients) = remove_dup(toaddrs, recipients) > + (toaddrs, recipients) = remove_dup(toaddrs + > accaddrs, recipients) > (ccaddrs, recipients) = remove_dup(ccaddrs, recipients) > - (accaddrs, recipients) = remove_dup(accaddrs, recipients) > (bccaddrs, recipients) = remove_dup(bccaddrs, recipients) > > # if there is not valid recipient, leave immediately > if len(recipients) < 1: > return > > - pcc = accaddrs > + pcc = [] > if public_cc: > pcc += ccaddrs > if toaddrs: > > > or hardcode a recipient in the "to" recipient list > > Index: trac/notification.py > =================================================================== > --- trac/notification.py (revision 4188) > +++ trac/notification.py (working copy) > @@ -326,6 +326,7 @@ > build_addresses(bccparam.replace(',', ' > ').split()) or [] > > recipients = [] > + toaddrs.append('joeuser[at]example.com') > (toaddrs, recipients) = remove_dup(toaddrs, recipients) > (ccaddrs, recipients) = remove_dup(ccaddrs, recipients) > (accaddrs, recipients) = remove_dup(accaddrs, recipients) > > > Note that in both cases, you *need* to enable 'use_public_cc' or no > 'To' header would be emitted. > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Trac Users" group. To post to this group, send email to trac-users[at]googlegroups.com To unsubscribe from this group, send email to trac-users-unsubscribe[at]googlegroups.com For more options, visit this group at http://groups.google.com/group/trac-users?hl=en -~----------~----~----~----~------~----~------~--~---
|