Edgewall Software
Home
Trac
Trac Hacks
Genshi
Babel
Bitten
Home
Download
Documentation
Mailing Lists
License
FAQ
Search:
Login
Preferences
Help/Guide
About Trac
Wiki
Timeline
Roadmap
Browse Source
View Tickets
New Ticket
Search
Context Navigation
+0
Start Page
Index
History
Editing CookBook/Notification/Templates
Adjust edit area height:
8
12
16
20
24
28
32
36
40
Edit side-by-side
== Customizing email content for MS Outlook MS Outlook normally presents plain text emails with a variable-width font, and as a result the ticket properties table will most certainly look like a mess in MS Outlook. This can be fixed with some customization of email template. Replace the following second row in the template: {{{ ${ticket_props} }}} === For Trac 1.4 and later, Jinja2 template: #jinja2 {{{ -------------------------------------------------------------------------- # set sel = ('Reporter', 'Owner', 'Type', 'Status', 'Priority', 'Milestone', 'Component', 'Severity', 'Resolution', 'Keywords') # for a in ticket_props.replace('|', '\n').splitlines()[1:-1]|map('trim'): # set a = a.split(':', 1)|map('trim')|list # if len(a) > 1 and a[0] in sel: ${'%-*s %s'|format(12, a[0] + ':', a[1])} # endif # endfor -------------------------------------------------------------------------- }}} === For Trac 1.2 and early, Genshi template: #genshi {{{ -------------------------------------------------------------------------- {% with pv = [(a[0].strip(), a[1].strip()) for a in [b.split(':') for b in [c.strip() for c in ticket_props.replace('|', '\n').splitlines()[1:-1]] if ':' in b]]; sel = ['Reporter', 'Owner', 'Type', 'Status', 'Priority', 'Milestone', 'Component', 'Severity', 'Resolution', 'Keywords'] %}\ ${'\n'.join('%-*s %s' % (12, p[0]+':', p[1]) for p in pv if p[0] in sel)} {% end %}\ -------------------------------------------------------------------------- }}} The table of ticket properties is replaced with a list of a selection of the properties. A tab character separates the name and value in such a way that most people should find this more pleasing than the default table when using MS Outlook. {{{#!div style="margin: 1em 1.75em; border:1px dotted" {{{#!html #42: testing<br /> --------------------------------------------------------------------------<br /> <table cellpadding=0> <tr><td>Reporter:</td><td>jonas@example.com</td></tr> <tr><td>Owner:</td><td>anonymous</td></tr> <tr><td>Type:</td><td>defect</td></tr> <tr><td>Status:</td><td>assigned</td></tr> <tr><td>Priority:</td><td>lowest</td></tr> <tr><td>Milestone:</td><td>0.9</td></tr> <tr><td>Component:</td><td>report system</td></tr> <tr><td>Severity:</td><td>major</td></tr> <tr><td>Resolution:</td><td> </td></tr> <tr><td>Keywords:</td><td> </td></tr> </table> --------------------------------------------------------------------------<br /> Changes:<br /> <br /> * component: changeset view => search system<br /> * priority: low => highest<br /> * owner: jonas => anonymous<br /> * cc: daniel@example.com =><br /> daniel@example.com, jonas@example.com<br /> * status: new => assigned<br /> <br /> Comment:<br /> I'm interested too!<br /> <br /> --<br /> Ticket URL: <http://example.com/trac/ticket/42><br /> My Project <http://myproj.example.com/><br /> }}} }}} **Important**: Only those ticket fields that are listed in `sel` are part of the HTML email. If you have defined custom ticket fields which are to be part of the email, then they have to be added to `sel`. Example: {{{ sel = ['Reporter', ..., 'Keywords', 'Custom1', 'Custom2'] }}} However, the solution is still a workaround to an automatically HTML-formatted email.
Note:
See
WikiFormatting
and
TracWiki
for help on editing wiki content.
Change information
Your email or username:
E-mail address and name can be saved in the
Preferences
Comment about this change (optional):
Note:
See
TracWiki
for help on using the wiki.