Edgewall Software

Version 2 (modified by figaro, 6 years ago) ( diff )

Use email in favor of e-mail

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}

with this (requires Python 2.6 or later):

--------------------------------------------------------------------------
{% 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\t%s' % (format(p[0]+':', ' <12'), 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.

#42: testing
--------------------------------------------------------------------------
Reporter:jonas@example.com
Owner:anonymous
Type:defect
Status:assigned
Priority:lowest
Milestone:0.9
Component:report system
Severity:major
Resolution:
Keywords:
--------------------------------------------------------------------------
Changes:

  * component:  changeset view => search system
  * priority:  low => highest
  * owner:  jonas => anonymous
  * cc:  daniel@example.com =>
          daniel@example.com, jonas@example.com
  * status:  new => assigned

Comment:
I'm interested too!

--
Ticket URL: <http://example.com/trac/ticket/42>
My Project <http://myproj.example.com/>

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 TracWiki for help on using the wiki.