Changes between Version 1 and Version 2 of TracNotification
- Timestamp:
- 08/21/13 19:46:14 (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracNotification
v1 v2 ˆà 2 2 [[TracGuideToc]]ˆà 3 3 ˆà 4 ˆà [[PageOutline]]ˆà 5 ˆà ˆà 6 ˆà Trac supports notification about ticket changes via email. ˆà ˆà 4 Trac supports notification of ticket changes via email. ˆà 7 5 ˆà 8 6 Email notification is useful to keep users up-to-date on tickets/issues of interest, and also provides a convenient way to post all ticket changes to a dedicated mailing list. For example, this is how the [http://lists.edgewall.com/archive/trac-tickets/ Trac-tickets] mailing list is set up.ˆà òÀæ òÀæ ˆà 20 18 ˆà 21 19 Alternatively, a default domain name ('''`smtp_default_domain`''') can be set in the TracIni file (see [#ConfigurationOptions Configuration Options] below). In this case, the default domain will be appended to the username, which can be useful for an "Intranet" kind of installation.ˆà ˆà 20 ˆà ˆà 21 When using apache and mod_kerb for authentication against Kerberos / Active Directory, usernames take the form ('''`username@EXAMPLE.LOCAL`'''). To avoid this being interpreted as an email address, add the Kerberos domain to ('''`ignore_domains`''').ˆà 22 22 ˆà 23 23 == Configuring SMTP Notification ==ˆà òÀæ òÀæ ˆà 41 41 * '''`use_public_cc`''': (''since 0.10'') Addresses in To: (owner, reporter) and Cc: lists are visible by all recipients (default is ''Bcc:'' - hidden copy).ˆà 42 42 * '''`use_short_addr`''': (''since 0.10'') Enable delivery of notifications to addresses that do not contain a domain (i.e. do not end with ''@<domain.com>'').This option is useful for intranets, where the SMTP server can handle local addresses and map the username/login to a local mailbox. See also `smtp_default_domain`. Do not use this option with a public SMTP server. ˆà 43 ˆà * '''`mime_encoding`''': (''since 0.10'') E-mail notifications are always sent in 7-bit mode. This option allows to select the MIME encoding scheme. Supported values:ˆà 44 ˆà * `base64`: default value, works with any kind of content. May cause some issues with touchy anti-spam/anti-virus engines.ˆà 45 ˆà * `qp` or `quoted-printable`: best for european languages (more compact than base64), not recommended for non-ASCII text (less compact than base64)ˆà 46 ˆà * `none`: no encoding. Use with plain english only (ASCII). E-mails with non-ASCII chars won't be delivered. ˆà ˆà 43 * '''`ignore_domains`''': Comma-separated list of domains that should not be considered part of email addresses (for usernames with Kerberos domains).ˆà ˆà 44 * '''`mime_encoding`''': (''since 0.10'') This option allows selecting the MIME encoding scheme. Supported values:ˆà ˆà 45 * `none`: default value, uses 7bit encoding if the text is plain ASCII, or 8bit otherwise. ˆà ˆà 46 * `base64`: works with any kind of content. May cause some issues with touchy anti-spam/anti-virus engines.ˆà ˆà 47 * `qp` or `quoted-printable`: best for european languages (more compact than base64) if 8bit encoding cannot be used.ˆà 47 48 * '''`ticket_subject_template`''': (''since 0.11'') A [http://genshi.edgewall.org/wiki/Documentation/text-templates.html Genshi text template] snippet used to get the notification subject.ˆà ˆà 49 * '''`email_sender`''': (''since 0.12'') Name of the component implementing `IEmailSender`. This component is used by the notification system to send emails. Trac currently provides the following components:ˆà ˆà 50 * `SmtpEmailSender`: connects to an SMTP server (default).ˆà ˆà 51 * `SendmailEmailSender`: runs a `sendmail`-compatible executable. ˆà 48 52 ˆà 49 53 Either '''`smtp_from`''' or '''`smtp_replyto`''' (or both) ''must'' be set, otherwise Trac refuses to send notification mails.ˆà òÀæ òÀæ ˆà 56 60 * '''`use_tls`''': (''since 0.10'') Toggle to send notifications via a SMTP server using [http://en.wikipedia.org/wiki/Transport_Layer_Security TLS], such as GMail.ˆà 57 61 ˆà ˆà 62 The following option is specific to email delivery through a `sendmail`-compatible executable.ˆà ˆà 63 * '''`sendmail_path`''': (''since 0.12'') Path to the sendmail executable. The sendmail program must accept the `-i` and `-f` options.ˆà 58 64 ˆà 59 65 === Example Configuration (SMTP) ===ˆà òÀæ òÀæ ˆà 67 73 }}}ˆà 68 74 ˆà ˆà 75 === Example Configuration (`sendmail`) ===ˆà ˆà 76 {{{ˆà ˆà 77 [notification]ˆà ˆà 78 smtp_enabled = trueˆà ˆà 79 email_sender = SendmailEmailSenderˆà ˆà 80 sendmail_path = /usr/sbin/sendmailˆà ˆà 81 smtp_from = notifier@example.comˆà ˆà 82 smtp_replyto = myproj@projects.example.comˆà ˆà 83 smtp_always_cc = ticketmaster@example.com, theboss+myproj@example.comˆà ˆà 84 }}}ˆà 69 85 ˆà 70 86 === Customizing the e-mail subject ===ˆà òÀæ òÀæ ˆà 82 98 === Customizing the e-mail content ===ˆà 83 99 ˆà 84 ˆà The notification e-mail content is generated based on `ticket_notify_email.txt` in `trac/t icket/templates`.The default looks like this:ˆàˆà 100 The notification e-mail content is generated based on `ticket_notify_email.txt` in `trac/templates`. You can add your own version of this template by adding a `ticket_notify_email.txt` to the templates directory of your environment. The default looks like this:ˆà 85 101 ˆà 86 102 {{{ˆà 87 103 $ticket_body_hdrˆà 88 104 $ticket_propsˆà 89 ˆà #choose ticket.newˆà 90 ˆà #when Trueˆà ˆà 105 {% choose ticket.new %}\ˆà ˆà 106 {% when True %}\ˆà 91 107 $ticket.descriptionˆà 92 ˆà #endˆà 93 ˆà #otherwiseˆà 94 ˆà #if changes_bodyˆà 95 ˆà Changes (by $change.author):ˆà ˆà 108 {% end %}\ˆà ˆà 109 {% otherwise %}\ˆà ˆà 110 {% if changes_body %}\ˆà ˆà 111 ${_('Changes (by %(author)s):', author=change.author)}ˆà 96 112 ˆà 97 113 $changes_bodyˆà 98 ˆà #endˆà 99 ˆà #if changes_descrˆà 100 ˆà #if not changes_body and not change.comment and change.authorˆà 101 ˆà Description changed by $change.author:ˆà 102 ˆà #endˆà ˆà 114 {% end %}\ˆà ˆà 115 {% if changes_descr %}\ˆà ˆà 116 {% if not changes_body and not change.comment and change.author %}\ˆà ˆà 117 ${_('Description changed by %(author)s:', author=change.author)}ˆà ˆà 118 {% end %}\ˆà 103 119 $changes_descrˆà 104 120 --ˆà 105 ˆà #endˆà 106 ˆà #if change.commentˆà 107 ˆà ˆà 108 ˆà Comment${not changes_body and '(by %s)' % change.author or ''}:ˆà ˆà 121 {% end %}\ˆà ˆà 122 {% if change.comment %}\ˆà ˆà 123 ˆà ˆà 124 ${changes_body and _('Comment:') or _('Comment (by %(author)s):', author=change.author)}ˆà 109 125 ˆà 110 126 $change.commentˆà 111 ˆà #endˆà 112 ˆà #endˆà 113 ˆà #endˆà ˆà 127 {% end %}\ˆà ˆà 128 {% end %}\ˆà ˆà 129 {% end %}\ˆà 114 130 ˆà 115 131 -- ˆà 116 ˆà Ticket URL: <$ticket.link>ˆà ˆà 132 ${_('Ticket URL: <%(link)s>', link=ticket.link)}ˆà 117 133 $project.name <${project.url or abs_href()}>ˆà 118 134 $project.descrˆà òÀæ òÀæ ˆà 144 160 }}}ˆà 145 161 ˆà ˆà 162 ˆà ˆà 163 == Customizing e-mail content for MS Outlook ==ˆà ˆà 164 ˆà ˆà 165 Out-of-the-box, MS Outlook normally presents plain text e-mails with a variable-width font; 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].ˆà ˆà 166 ˆà ˆà 167 Replace the following second row in the template:ˆà ˆà 168 {{{ˆà ˆà 169 $ticket_propsˆà ˆà 170 }}}ˆà ˆà 171 ˆà ˆà 172 with this instead (''requires Python 2.6 or later''):ˆà ˆà 173 {{{ˆà ˆà 174 --------------------------------------------------------------------------ˆà ˆà 175 {% withˆà ˆà 176 pv = [(a[0].strip(), a[1].strip()) for a in [b.split(':') for b inˆà ˆà 177 [c.strip() for c in ˆà ˆà 178 ticket_props.replace('|', '\n').splitlines()[1:-1]] if ':' in b]];ˆà ˆà 179 sel = ['Reporter', 'Owner', 'Type', 'Status', 'Priority', 'Milestone', ˆà ˆà 180 'Component', 'Severity', 'Resolution', 'Keywords'] %}\ˆà ˆà 181 ${'\n'.join('%s\t%s' % (format(p[0]+':', ' <12'), p[1]) for p in pv if p[0] in sel)}ˆà ˆà 182 {% end %}\ˆà ˆà 183 --------------------------------------------------------------------------ˆà ˆà 184 }}}ˆà ˆà 185 ˆà ˆà 186 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.ˆà ˆà 187 {{{#!div style="margin: 1em 1.75em; border:1px dotted"ˆà ˆà 188 {{{#!htmlˆà ˆà 189 #42: testing<br />ˆà ˆà 190 --------------------------------------------------------------------------<br />ˆà ˆà 191 <table cellpadding=0>ˆà ˆà 192 <tr><td>Reporter:</td><td>jonas@example.com</td></tr>ˆà ˆà 193 <tr><td>Owner:</td><td>anonymous</td></tr>ˆà ˆà 194 <tr><td>Type:</td><td>defect</td></tr>ˆà ˆà 195 <tr><td>Status:</td><td>assigned</td></tr>ˆà ˆà 196 <tr><td>Priority:</td><td>lowest</td></tr>ˆà ˆà 197 <tr><td>Milestone:</td><td>0.9</td></tr>ˆà ˆà 198 <tr><td>Component:</td><td>report system</td></tr>ˆà ˆà 199 <tr><td>Severity:</td><td>major</td></tr>ˆà ˆà 200 <tr><td>Resolution:</td><td> </td></tr>ˆà ˆà 201 <tr><td>Keywords:</td><td> </td></tr>ˆà ˆà 202 </table>ˆà ˆà 203 --------------------------------------------------------------------------<br />ˆà ˆà 204 Changes:<br />ˆà ˆà 205 <br />ˆà ˆà 206 * component: changset view => search system<br />ˆà ˆà 207 * priority: low => highest<br />ˆà ˆà 208 * owner: jonas => anonymous<br />ˆà ˆà 209 * cc: daniel@example.com =><br />ˆà ˆà 210 daniel@example.com, jonas@example.com<br />ˆà ˆà 211 * status: new => assigned<br />ˆà ˆà 212 <br />ˆà ˆà 213 Comment:<br />ˆà ˆà 214 I'm interested too!<br />ˆà ˆà 215 <br />ˆà ˆà 216 --<br />ˆà ˆà 217 Ticket URL: <http://example.com/trac/ticket/42><br />ˆà ˆà 218 My Project <http://myproj.example.com/><br />ˆà ˆà 219 }}}ˆà ˆà 220 }}}ˆà ˆà 221 ˆà ˆà 222 **Important**: Only those ticket fields that are listed in `sel` are part of the HTML mail. If you have defined custom ticket fields which shall be part of the mail they have to be added to `sel`, example:ˆà ˆà 223 {{{ˆà ˆà 224 sel = ['Reporter', ..., 'Keywords', 'Custom1', 'Custom2']ˆà ˆà 225 }}}ˆà ˆà 226 ˆà ˆà 227 However, it's not as perfect as an automatically HTML-formatted e-mail would be, but presented ticket properties are at least readable by default in MS Outlook...ˆà ˆà 228 ˆà ˆà 229 ˆà 146 230 == Using GMail as the SMTP relay host ==ˆà 147 231 ˆà