Changes between Version 3 and Version 4 of TracNotification


Ignore:
Timestamp:
09/24/12 18:52:15 (13 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracNotification

    v3 v4  
    3131 * '''`smtp_from`''': Email address to use for ''Sender''-headers in notification emails.
    3232 * '''`smtp_from_name`''': Sender name to use for ''Sender''-headers in notification emails.
     33 * '''`smtp_from_author`''': (''since 1.0'') Use the author of a change (the reporter of a new ticket, or the author of a comment) as the `From:` header value in notification e-mails (default: false). If the author hasn't set an e-mail address, `smtp_from` and `smtp_from_name` are used instead.
    3334 * '''`smtp_replyto`''': Email address to use for ''Reply-To''-headers in notification emails.
    3435 * '''`smtp_default_domain`''': (''since 0.10'') Append the specified domain to addresses that do not contain one. Fully qualified addresses are not modified. The default domain is appended to all username/login for which an email address cannot be found from the user settings.
     
    4950 * '''`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:
    5051   * `SmtpEmailSender`: connects to an SMTP server (default).
    51    * `SendmailEmailSender`: runs a `sendmail`-compatible executable.   
     52   * `SendmailEmailSender`: runs a `sendmail`-compatible executable.
    5253
    5354Either '''`smtp_from`''' or '''`smtp_replyto`''' (or both) ''must'' be set, otherwise Trac refuses to send notification mails.
     
    9899=== Customizing the e-mail content ===
    99100
    100 The notification e-mail content is generated based on `ticket_notify_email.txt` in `trac/ticket/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:
     101The 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:
    101102
    102103{{{
    103104$ticket_body_hdr
    104105$ticket_props
    105 {% choose ticket.new %}\\
    106 {%   when True %}\\
     106{% choose ticket.new %}\
     107{%   when True %}\
    107108$ticket.description
    108 {%   end %}\\
    109 {%   otherwise %}\\
    110 {%     if changes_body %}\\
     109{%   end %}\
     110{%   otherwise %}\
     111{%     if changes_body %}\
    111112${_('Changes (by %(author)s):', author=change.author)}
    112113
    113114$changes_body
    114 {%     end %}\\
    115 {%     if changes_descr %}\\
    116 {%       if not changes_body and not change.comment and change.author %}\\
     115{%     end %}\
     116{%     if changes_descr %}\
     117{%       if not changes_body and not change.comment and change.author %}\
    117118${_('Description changed by %(author)s:', author=change.author)}
    118 {%       end %}\\
     119{%       end %}\
    119120$changes_descr
    120121--
    121 {%     end %}\\
    122 {%     if change.comment %}\\
     122{%     end %}\
     123{%     if change.comment %}\
    123124
    124125${changes_body and _('Comment:') or _('Comment (by %(author)s):', author=change.author)}
    125126
    126127$change.comment
    127 {%     end %}\\
    128 {%   end %}\\
    129 {% end %}\\
     128{%     end %}\
     129{%   end %}\
     130{% end %}\
    130131
    131132--
     
    170171}}}
    171172
    172 with this instead:
     173with this instead (''requires Python 2.6 or later''):
    173174{{{
    174175--------------------------------------------------------------------------
     
    176177   pv = [(a[0].strip(), a[1].strip()) for a in [b.split(':') for b in
    177178         [c.strip() for c in
    178           ticket_props.replace('|', '\\n').splitlines()[1:-1]] if ':' in b]];
     179          ticket_props.replace('|', '\n').splitlines()[1:-1]] if ':' in b]];
    179180   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 %}\\
     181          'Component', 'Severity', 'Resolution', 'Keywords'] %}\
     182${'\n'.join('%s\t%s' % (format(p[0]+':', ' <12'), p[1]) for p in pv if p[0] in sel)}
     183{% end %}\
    183184--------------------------------------------------------------------------
    184185}}}
     
    220221}}}
    221222
    222 However, it's not as perfect as an HTML formatted e-mail would be, but presented ticket properties are at least readable...
     223**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:
     224{{{
     225   sel = ['Reporter', ..., 'Keywords', 'Custom1', 'Custom2']
     226}}}
     227
     228However, 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...
    223229
    224230