Edgewall Software

Changes between Version 97 and Version 98 of TracNotification


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

Move customization for outlook to the CookBook.

Legend:

Unmodified
Added
Removed
Modified
  • TracNotification

    v97 v98  
    146146${project.descr}
    147147}}}
     148
     149See the [trac:CookBook/Notification/Templates cookbook] for additional template customization recipes.
    148150
    149151== Sample Email
     
    173175}}}
    174176
    175 == Customizing e-mail content for MS Outlook
    176 
    177 MS 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].
    178 
    179 Replace the following second row in the template:
    180 {{{
    181 ${ticket_props}
    182 }}}
    183 
    184 with this (requires Python 2.6 or later):
    185 {{{
    186 --------------------------------------------------------------------------
    187 {% with
    188    pv = [(a[0].strip(), a[1].strip()) for a in [b.split(':') for b in
    189          [c.strip() for c in
    190           ticket_props.replace('|', '\n').splitlines()[1:-1]] if ':' in b]];
    191    sel = ['Reporter', 'Owner', 'Type', 'Status', 'Priority', 'Milestone',
    192           'Component', 'Severity', 'Resolution', 'Keywords'] %}\
    193 ${'\n'.join('%s\t%s' % (format(p[0]+':', ' <12'), p[1]) for p in pv if p[0] in sel)}
    194 {% end %}\
    195 --------------------------------------------------------------------------
    196 }}}
    197 
    198 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.
    199 {{{#!div style="margin: 1em 1.75em; border:1px dotted"
    200 {{{#!html
    201 #42: testing<br />
    202 --------------------------------------------------------------------------<br />
    203 <table cellpadding=0>
    204 <tr><td>Reporter:</td><td>jonas@example.com</td></tr>
    205 <tr><td>Owner:</td><td>anonymous</td></tr>
    206 <tr><td>Type:</td><td>defect</td></tr>
    207 <tr><td>Status:</td><td>assigned</td></tr>
    208 <tr><td>Priority:</td><td>lowest</td></tr>
    209 <tr><td>Milestone:</td><td>0.9</td></tr>
    210 <tr><td>Component:</td><td>report system</td></tr>
    211 <tr><td>Severity:</td><td>major</td></tr>
    212 <tr><td>Resolution:</td><td> </td></tr>
    213 <tr><td>Keywords:</td><td> </td></tr>
    214 </table>
    215 --------------------------------------------------------------------------<br />
    216 Changes:<br />
    217 <br />
    218 &nbsp;&nbsp;* component: &nbsp;changeset view =&gt; search system<br />
    219 &nbsp;&nbsp;* priority: &nbsp;low =&gt; highest<br />
    220 &nbsp;&nbsp;* owner: &nbsp;jonas =&gt; anonymous<br />
    221 &nbsp;&nbsp;* cc: &nbsp;daniel@example.com =&gt;<br />
    222 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;daniel@example.com, jonas@example.com<br />
    223 &nbsp;&nbsp;* status: &nbsp;new =&gt; assigned<br />
    224 <br />
    225 Comment:<br />
    226 I'm interested too!<br />
    227 <br />
    228 --<br />
    229 Ticket URL: &lt;http://example.com/trac/ticket/42&gt;<br />
    230 My Project &lt;http://myproj.example.com/&gt;<br />
    231 }}}
    232 }}}
    233 
    234 **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:
    235 {{{
    236    sel = ['Reporter', ..., 'Keywords', 'Custom1', 'Custom2']
    237 }}}
    238 
    239 However, the solution is still a workaround to an automatically HTML-formatted e-mail.
    240 
    241177== Using GMail as the SMTP relay host
    242178