Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Trac: Users

modifying ticket notification email behavior

 

 

Trac users RSS feed   Index | Next | Previous | View Threaded


jbogden at sandia

Nov 15, 2006, 11:15 AM

Post #1 of 3 (1660 views)
Permalink
modifying ticket notification email behavior

I'm trying to send Trac ticket notifications to a mailing list that
appears to only accept email when the list is explicitly in the TO list.
The only way I found in Trac to add a mailing list for all ticket
notifications is with the smtp_always_cc config in trac.ini. Is there a
way to add an email address that will always be in the TO address list?
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. I'm sure this is
mostly due to my novice Python knowledge. Any ideas? Thanks.


--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to trac-users-unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---


manu.blot at gmail

Nov 15, 2006, 1:12 PM

Post #2 of 3 (1563 views)
Permalink
Re: modifying ticket notification email behavior [In reply to]

> 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. I'm sure this is
> mostly due to my novice Python knowledge. Any ideas? Thanks.

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')
(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.

HTH,
Manu

--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to trac-users-unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---


jbogden at sandia

Nov 22, 2006, 11:07 AM

Post #3 of 3 (1553 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')
+ #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')
> (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
To unsubscribe from this group, send email to trac-users-unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Trac users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.