Edgewall Software

Changes between Initial Version and Version 1 of CookBook/Notification/Templates


Ignore:
Timestamp:
Apr 3, 2017, 5:04:54 AM (7 years ago)
Author:
Ryan J Ollos
Comment:

Moved from TracNotification@98.

Legend:

Unmodified
Added
Removed
Modified
  • CookBook/Notification/Templates

    v1 v1  
     1== Customizing e-mail content for MS Outlook
     2
     3MS Outlook normally presents plain text e-mails 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 the [#Customizingthee-mailcontent e-mail template].
     4
     5Replace the following second row in the template:
     6{{{
     7${ticket_props}
     8}}}
     9
     10with this (requires Python 2.6 or later):
     11{{{
     12--------------------------------------------------------------------------
     13{% with
     14   pv = [(a[0].strip(), a[1].strip()) for a in [b.split(':') for b in
     15         [c.strip() for c in
     16          ticket_props.replace('|', '\n').splitlines()[1:-1]] if ':' in b]];
     17   sel = ['Reporter', 'Owner', 'Type', 'Status', 'Priority', 'Milestone',
     18          'Component', 'Severity', 'Resolution', 'Keywords'] %}\
     19${'\n'.join('%s\t%s' % (format(p[0]+':', ' <12'), p[1]) for p in pv if p[0] in sel)}
     20{% end %}\
     21--------------------------------------------------------------------------
     22}}}
     23
     24The 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.
     25{{{#!div style="margin: 1em 1.75em; border:1px dotted"
     26{{{#!html
     27#42: testing<br />
     28--------------------------------------------------------------------------<br />
     29<table cellpadding=0>
     30<tr><td>Reporter:</td><td>jonas@example.com</td></tr>
     31<tr><td>Owner:</td><td>anonymous</td></tr>
     32<tr><td>Type:</td><td>defect</td></tr>
     33<tr><td>Status:</td><td>assigned</td></tr>
     34<tr><td>Priority:</td><td>lowest</td></tr>
     35<tr><td>Milestone:</td><td>0.9</td></tr>
     36<tr><td>Component:</td><td>report system</td></tr>
     37<tr><td>Severity:</td><td>major</td></tr>
     38<tr><td>Resolution:</td><td> </td></tr>
     39<tr><td>Keywords:</td><td> </td></tr>
     40</table>
     41--------------------------------------------------------------------------<br />
     42Changes:<br />
     43<br />
     44&nbsp;&nbsp;* component: &nbsp;changeset view =&gt; search system<br />
     45&nbsp;&nbsp;* priority: &nbsp;low =&gt; highest<br />
     46&nbsp;&nbsp;* owner: &nbsp;jonas =&gt; anonymous<br />
     47&nbsp;&nbsp;* cc: &nbsp;daniel@example.com =&gt;<br />
     48&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;daniel@example.com, jonas@example.com<br />
     49&nbsp;&nbsp;* status: &nbsp;new =&gt; assigned<br />
     50<br />
     51Comment:<br />
     52I'm interested too!<br />
     53<br />
     54--<br />
     55Ticket URL: &lt;http://example.com/trac/ticket/42&gt;<br />
     56My Project &lt;http://myproj.example.com/&gt;<br />
     57}}}
     58}}}
     59
     60**Important**: Only those ticket fields that are listed in `sel` are part of the HTML mail. If you have defined custom ticket fields which are to be part of the mail, then they have to be added to `sel`. Example:
     61{{{
     62   sel = ['Reporter', ..., 'Keywords', 'Custom1', 'Custom2']
     63}}}
     64
     65However, the solution is still a workaround to an automatically HTML-formatted e-mail.