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 | | * component: changeset view => search system<br /> |
219 | | * priority: low => highest<br /> |
220 | | * owner: jonas => anonymous<br /> |
221 | | * cc: daniel@example.com =><br /> |
222 | | daniel@example.com, jonas@example.com<br /> |
223 | | * status: new => assigned<br /> |
224 | | <br /> |
225 | | Comment:<br /> |
226 | | I'm interested too!<br /> |
227 | | <br /> |
228 | | --<br /> |
229 | | Ticket URL: <http://example.com/trac/ticket/42><br /> |
230 | | My Project <http://myproj.example.com/><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 | | |