The Third Bear

Just Right.

Triggering Trac emails based on workflow actions

egj trac , opensource

I've released a new (BSD licensed) plugin on Trac Hacks.  WorkflowNotificationPlugin enables configurable email notifications tied to ticket workflow events.  For example, you could set up one email notification to be sent out when the "resolve" action is taken, and a different email notification to be sent out when the "accept" or "reassign" actions are taken.

The plugin does not make any assumptions about your workflow configuration, or even whether you're using the built-in ITicketActionController at all.

Notifications are configured through trac.ini using a syntax that's similar to Trac's built-in configurable workflow.  Each notification's subject, body, and recipient list is defined as a Genshi template, whose template context includes the ticket's new values, old values, and the change comment and author.  So notifications can be quite flexible; you could send out a notification to the ticket's reporter and CC list, or to a hard coded list of email addresses and usernames, or to the value of some custom field, etc.  You can also use this plugin to generate something like Trac's built in ticket notification email, by comparing the ticket's old values and new values in the "body" template.

You can also configure conditional notifications.  For example, you can set up a notification that will be sent out when the "resolve" action occurs, but only if the ticket's new resolution is "fixed".

More usage details and examples are available on the plugin's wiki page at Trac Hacks.  I'll also try to write some followup posts detailing some useful configurations you might use.