Opened 7 years ago

Closed 3 years ago

Last modified 3 years ago

#6237 closed enhancement (fixed)

Email Changes in Ticket

Reported by: shubham_chakraborty@… Owned by: sinnvoller
Priority: normal Component: TicketTeamDispatcherPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11


This is in reference to ticket #6201 Please try making a ticketTeamdispatcher plugin send out notifications for subsequent changes done to the ticket to the Team selected.

This is because the point of having edit notifications being sent is that for example, 10 people on a team working on a ticket to solve...if subsequent notifcation arent sent, then unless each and everyone explicitly watches (watchlist plugin) or start working on it (worklog plugin), the ticket status remains unknown to them till the next time he checks on it. So upon closure by another member(with ticket_modify perm ofcourse), the other members could simply be working on an already closed ticket.

Also,if the Team needs to be changed, that is a new team to be assigned if the current team isnt capable..or as for corporate environments (ticket transferred between Onsite and Offshore members). In these cases, notifications for changes ALSO would be appreciated.

:) thnx

Attachments (0)

Change History (7)

comment:1 Changed 3 years ago by asdorsey

Seconded, I am running into this issue now as well.

comment:2 Changed 3 years ago by asdorsey

Solution listed at #6201:

You just have to adjust 0.11/ttd/ and replace the Lines saying 'pass' with these two lines:

mail = SpecialTicketNotifyEmail(self.env) mail.notify(ticket)

Last edited 3 years ago by rjollos (previous) (diff)

comment:3 Changed 3 years ago by asdorsey

I am currently working on an update that will allow configuring email notifications for creation, change and deletion of tickets. Once this is complete and I obtain permission to commit my changes, this issue will be resolved.

comment:4 Changed 3 years ago by asdorsey

Add the ability to configure whether emails are sent on ticket creation, modification or deletion. These options are configured under the [ttd] section of trac.ini as follows:

email_on_create: Boolean (true|false), send email on ticket creation email_on_change: Boolean (true|false), send email on ticket modification email_on_delete: Boolean (true|false), send email on ticket deletion

For now these options will need to be entered manually on ticket install. Web admin entries and defaults will come later.

Diff of changes:

  • ttd/

    11from trac.core import Component, implements
    22from trac.ticket.api import ITicketChangeListener
     3from datetime import datetime
     4from trac.util.datefmt import utc
    57from notification import SpecialTicketNotifyEmail
    810    implements(ITicketChangeListener)
    1012    def ticket_created(self, ticket):
    11         mail = SpecialTicketNotifyEmail(self.env)
    12         mail.notify(ticket)
     13        do_mail = self.config.getbool('ttd', 'email_on_create')
     14        if do_mail:
     15            mail = SpecialTicketNotifyEmail(self.env)
     16            mail.notify(ticket)
    1418    def ticket_changed(self, ticket, comment, author, old_values):
    15         pass
     19        do_mail = self.config.getbool('ttd', 'email_on_change')
     20        if do_mail:
     21            now =
     22            mail = SpecialTicketNotifyEmail(self.env)
     23            mail.notify(ticket, False, now)
    1725    def ticket_deleted(self, ticket):
    18         pass
     26        do_mail = self.config.getbool('ttd', 'email_on_delete')
     27        if do_mail:
     28            now =
     29            mail = SpecialTicketNotifyEmail(self.env)
     30            mail.notify(ticket, False, now)

I can commit this if I can get permission to do so (I get a 403 Forbidden when I attempt to do so at the moment)

Edit: Updated diff.

Last edited 3 years ago by rjollos (previous) (diff)

comment:5 Changed 3 years ago by rjollos

  • Resolution set to fixed
  • Status changed from new to closed

In 13586:

0.3dev: Added options that determine when notifications are set:

  • notify_on_create (default: True)
  • notify_on_change (default: False)
  • notify_on_delete (default: False)

Initial patch by asdorsey. Fixes #6237.

comment:6 Changed 3 years ago by rjollos

The basics of the patch are okay, but there are some subtle issue:

  • When adding options to a plugin, the Option class or subclasses such as BoolOption should be used: browser:/branches/1.0-stable/trac/
  • I used notify rather than email in the option names, since it seems to be more consistent with the Trac nomenclature.
  • I used team-dispatcher as the section name since ttd isn't very descriptive.
  • The ticket changes were not being included in the notification. The modtime is used to lookup the changelog entries, so we need to use the ticket's changetime (which will equal the modtime of the change that we are sending the notification for).
  • The email notification on ticket delete did not provide any indication that the ticket was being deleted, so I appended (delete) to the Summary (which becomes the subject of the email).

Please test out the latest and report any issues you find.

Side note: Eventually, the AnnouncerPlugin (the core of which is being integrated to Trac for release 1.2), should provide equivalent functionality to this plugin through it's subscriber mechanism.

Last edited 3 years ago by rjollos (previous) (diff)

comment:7 Changed 3 years ago by asdorsey

Just tested the new functionality, it looks great. Emails are being sent on ticket modification and deletion once the plugin is configured. I was wondering why the comments weren't showing up, thanks for the info on that function.

And thanks for the tips on plugin development, Trac hacks are somewhat new to me :)

Add Comment

Modify Ticket

as closed The owner will remain sinnvoller.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.