| 1 | == Customizing e-mail content for MS Outlook |
| 2 | |
| 3 | 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]. |
| 4 | |
| 5 | Replace the following second row in the template: |
| 6 | {{{ |
| 7 | ${ticket_props} |
| 8 | }}} |
| 9 | |
| 10 | with 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 | |
| 24 | 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. |
| 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 /> |
| 42 | Changes:<br /> |
| 43 | <br /> |
| 44 | * component: changeset view => search system<br /> |
| 45 | * priority: low => highest<br /> |
| 46 | * owner: jonas => anonymous<br /> |
| 47 | * cc: daniel@example.com =><br /> |
| 48 | daniel@example.com, jonas@example.com<br /> |
| 49 | * status: new => assigned<br /> |
| 50 | <br /> |
| 51 | Comment:<br /> |
| 52 | I'm interested too!<br /> |
| 53 | <br /> |
| 54 | --<br /> |
| 55 | Ticket URL: <http://example.com/trac/ticket/42><br /> |
| 56 | My Project <http://myproj.example.com/><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 | |
| 65 | However, the solution is still a workaround to an automatically HTML-formatted e-mail. |