Äîêóìåíò âçÿò èç êýøà ïîèñêîâîé ìàøèíû. Àäðåñ îðèãèíàëüíîãî äîêóìåíòà : http://kodomo.cmm.msu.ru/trac/tanchiki/wiki/TracNotification?action=diff&version=2
Äàòà èçìåíåíèÿ: Unknown
Äàòà èíäåêñèðîâàíèÿ: Mon Apr 11 21:47:35 2016
Êîäèðîâêà: IBM-866
TracNotification (diff) òÀÓ Tanchiki

Changes between Version 1 and Version 2 of TracNotification


Ignore:
Timestamp:
08/21/13 19:46:14 (3 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracNotification

    v1 v2 ˆà
    22[[TracGuideToc]]ˆà
    33ˆà
    4ˆà[[PageOutline]]ˆà
    5ˆàˆà
    6ˆàTrac supports notification about ticket changes via email. ˆà
    ˆà4Trac supports notification of ticket changes via email. ˆà
    75ˆà
    86Email 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.ˆà
    òÀæ òÀæ ˆà
    2018ˆà
    2119Alternatively, 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ˆà
    ˆà21When 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`''').ˆà
    2222ˆà
    2323== Configuring SMTP Notification ==ˆà
    òÀæ òÀæ ˆà
    4141 * '''`use_public_cc`''': (''since 0.10'') Addresses in To: (owner, reporter) and Cc: lists are visible by all recipients (default is ''Bcc:'' - hidden copy).ˆà
    4242 * '''`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.ˆà
    4748 * '''`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.   ˆà
    4852ˆà
    4953Either '''`smtp_from`''' or '''`smtp_replyto`''' (or both) ''must'' be set, otherwise Trac refuses to send notification mails.ˆà
    òÀæ òÀæ ˆà
    5660 * '''`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.ˆà
    5761ˆà
    ˆà62The 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.ˆà
    5864ˆà
    5965=== Example Configuration (SMTP) ===ˆà
    òÀæ òÀæ ˆà
    6773}}}ˆà
    6874ˆà
    ˆà75=== Example Configuration (`sendmail`) ===ˆà
    ˆà76{{{ˆà
    ˆà77[notification]ˆà
    ˆà78smtp_enabled = trueˆà
    ˆà79email_sender = SendmailEmailSenderˆà
    ˆà80sendmail_path = /usr/sbin/sendmailˆà
    ˆà81smtp_from = notifier@example.comˆà
    ˆà82smtp_replyto = myproj@projects.example.comˆà
    ˆà83smtp_always_cc = ticketmaster@example.com, theboss+myproj@example.comˆà
    ˆà84}}}ˆà
    6985ˆà
    7086=== Customizing the e-mail subject ===ˆà
    òÀæ òÀæ ˆà
    8298=== Customizing the e-mail content ===ˆà
    8399ˆà
    84ˆàThe notification e-mail content is generated based on `ticket_notify_email.txt` in `trac/ticket/templates`. The default looks like this:ˆà
    ˆà100The 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:ˆà
    85101ˆà
    86102{{{ˆà
    87103$ticket_body_hdrˆà
    88104$ticket_propsˆà
    89ˆà#choose ticket.newˆà
    90ˆà  #when Trueˆà
    ˆà105{% choose ticket.new %}\ˆà
    ˆà106{%   when True %}\ˆà
    91107$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)}ˆà
    96112ˆà
    97113$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 %}\ˆà
    103119$changes_descrˆà
    104120--ˆà
    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)}ˆà
    109125ˆà
    110126$change.commentˆà
    111ˆà    #endˆà
    112ˆà  #endˆà
    113ˆà#endˆà
    ˆà127{%     end %}\ˆà
    ˆà128{%   end %}\ˆà
    ˆà129{% end %}\ˆà
    114130ˆà
    115131-- ˆà
    116ˆàTicket URL: <$ticket.link>ˆà
    ˆà132${_('Ticket URL: <%(link)s>', link=ticket.link)}ˆà
    117133$project.name <${project.url or abs_href()}>ˆà
    118134$project.descrˆà
    òÀæ òÀæ ˆà
    144160}}}ˆà
    145161ˆà
    ˆà162ˆà
    ˆà163== Customizing e-mail content for MS Outlook ==ˆà
    ˆà164ˆà
    ˆà165Out-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ˆà
    ˆà167Replace the following second row in the template:ˆà
    ˆà168{{{ˆà
    ˆà169$ticket_propsˆà
    ˆà170}}}ˆà
    ˆà171ˆà
    ˆà172with 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ˆà
    ˆà186The 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 />ˆà
    ˆà204Changes:<br />ˆà
    ˆà205<br />ˆà
    ˆà206&nbsp;&nbsp;* component: &nbsp;changset view =&gt; search system<br />ˆà
    ˆà207&nbsp;&nbsp;* priority: &nbsp;low =&gt; highest<br />ˆà
    ˆà208&nbsp;&nbsp;* owner: &nbsp;jonas =&gt; anonymous<br />ˆà
    ˆà209&nbsp;&nbsp;* cc: &nbsp;daniel@example.com =&gt;<br />ˆà
    ˆà210&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;daniel@example.com, jonas@example.com<br />ˆà
    ˆà211&nbsp;&nbsp;* status: &nbsp;new =&gt; assigned<br />ˆà
    ˆà212<br />ˆà
    ˆà213Comment:<br />ˆà
    ˆà214I'm interested too!<br />ˆà
    ˆà215<br />ˆà
    ˆà216--<br />ˆà
    ˆà217Ticket URL: &lt;http://example.com/trac/ticket/42&gt;<br />ˆà
    ˆà218My Project &lt;http://myproj.example.com/&gt;<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ˆà
    ˆà227However, 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ˆà
    146230== Using GMail as the SMTP relay host ==ˆà
    147231ˆà