Changes between Version 1 and Version 2 of TracNotification


Ignore:
Timestamp:
02/25/11 22:52:52 (13 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracNotification

    v1 v2  
    22[[TracGuideToc]] 
    33 
    4 Trac supports notification about ticket changes via email.  
     4Trac supports notification of ticket changes via email.  
    55 
    66Email 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. 
     
    99 
    1010== Receiving Notification Mails == 
    11 When reporting a new ticket or adding a comment, enter a valid email address in the ''reporter'', ''assigned to/owner'' or ''cc'' field. Trac will automatically send you an email when changes are made to the ticket (depending on how notification is configured). 
     11When reporting a new ticket or adding a comment, enter a valid email address or your username in the ''reporter'', ''assigned to/owner'' or ''cc'' field. Trac will automatically send you an email when changes are made to the ticket (depending on how notification is configured). 
    1212 
    1313This is useful to keep up-to-date on an issue or enhancement request that interests you. 
    1414 
     15=== How to use your username to receive notification mails === 
     16 
     17To receive notification mails, you can either enter a full email address or your username. To get notified with a simple username or login, you need to specify a valid email address in the ''Preferences'' page.  
     18 
     19Alternatively, 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 
    1521== Configuring SMTP Notification == 
     22 
     23'''Important:''' For TracNotification to work correctly, the `[trac] base_url` option must be set in [wiki:TracIni trac.ini].  
    1624 
    1725=== Configuration Options === 
     
    3139 * '''`use_public_cc`''': (''since 0.10'') Addresses in To: (owner, reporter) and Cc: lists are visible by all recipients (default is ''Bcc:'' - hidden copy). 
    3240 * '''`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.  
    33  * '''`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: 
    34    * `base64`: default value, works with any kind of content. May cause some issues with touchy anti-spam/anti-virus engines. 
    35    * `qp` or `quoted-printable`: best for european languages (more compact than base64), not recommended for non-ASCII text (less compact than base64) 
    36    * `none`: no encoding. Use with plain english only (ASCII). E-mails with non-ASCII chars won't be delivered.  
     41 * '''`mime_encoding`''': (''since 0.10'') This option allows selecting the MIME encoding scheme. Supported values: 
     42   * `none`: default value, uses 7bit encoding if the text is plain ASCII, or 8bit otherwise.  
     43   * `base64`: works with any kind of content. May cause some issues with touchy anti-spam/anti-virus engines. 
     44   * `qp` or `quoted-printable`: best for european languages (more compact than base64) if 8bit encoding cannot be used. 
    3745 * '''`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. 
     46 * '''`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: 
     47   * `SmtpEmailSender`: connects to an SMTP server (default). 
     48   * `SendmailEmailSender`: runs a `sendmail`-compatible executable. 
    3849 
    3950Either '''`smtp_from`''' or '''`smtp_replyto`''' (or both) ''must'' be set, otherwise Trac refuses to send notification mails. 
     
    4657 * '''`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. 
    4758 
     59The following option is specific to email delivery through a `sendmail`-compatible executable. 
     60 * '''`sendmail_path`''': (''since 0.12'') Path to the sendmail executable. The sendmail program must accept the `-i` and `-f` options. 
    4861 
    4962=== Example Configuration (SMTP) === 
     
    5770}}} 
    5871 
     72=== Example Configuration (`sendmail`) === 
     73{{{ 
     74[notification] 
     75smtp_enabled = true 
     76email_sender = SendmailEmailSender 
     77sendmail_path = /usr/sbin/sendmail 
     78smtp_from = notifier@example.com 
     79smtp_replyto = myproj@projects.example.com 
     80smtp_always_cc = ticketmaster@example.com, theboss+myproj@example.com 
     81}}} 
    5982 
    6083=== Customizing the e-mail subject === 
     
    7093 * `ticket`: The ticket model object (see [trac:source:/trunk/trac/ticket/model.py model.py]). Individual ticket fields can be addressed by appending the field name separated by a dot, e.g. `$ticket.milestone`. 
    7194 
     95=== Customizing the e-mail content === 
     96 
     97The 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: 
     98 
     99{{{ 
     100$ticket_body_hdr 
     101$ticket_props 
     102#choose ticket.new 
     103  #when True 
     104$ticket.description 
     105  #end 
     106  #otherwise 
     107    #if changes_body 
     108Changes (by $change.author): 
     109 
     110$changes_body 
     111    #end 
     112    #if changes_descr 
     113      #if not changes_body and not change.comment and change.author 
     114Description changed by $change.author: 
     115      #end 
     116$changes_descr 
     117-- 
     118    #end 
     119    #if change.comment 
     120 
     121Comment${not changes_body and '(by %s)' % change.author or ''}: 
     122 
     123$change.comment 
     124    #end 
     125  #end 
     126#end 
     127 
     128--  
     129Ticket URL: <$ticket.link> 
     130$project.name <${project.url or abs_href()}> 
     131$project.descr 
     132}}} 
    72133== Sample Email == 
    73134{{{ 
     
    122183}}} 
    123184 
     185For Trac .10, use the filter: 
     186{{{ 
     187from:(<smtp_from>) (("Reporter: <username>" -Changes -Comment) OR "Changes (by <username>)" OR "Comment (by <username>)") 
     188}}} 
     189 
    124190to delete these notifications. 
    125191 
     
    164230Relevant ML threads: 
    165231 * SELinux: http://article.gmane.org/gmane.comp.version-control.subversion.trac.general/7518 
    166   
     232 
     233For SELinux in Fedora 10: 
     234{{{ 
     235$ setsebool -P httpd_can_sendmail 1 
     236}}} 
    167237=== ''Suspected spam'' error === 
    168238 
     
    172242 
    173243Quoted printable encoding works better with languages that use one of the Latin charsets. For Asian charsets, it is recommended to stick with the Base64 encoding. 
     244 
     245=== ''501, 5.5.4 Invalid Address'' error === 
     246 
     247On IIS 6.0 you could get a  
     248{{{ 
     249Failure sending notification on change to ticket #1: SMTPHeloError: (501, '5.5.4 Invalid Address') 
     250}}} 
     251in the trac log. Have a look [http://support.microsoft.com/kb/291828 here] for instructions on resolving it. 
     252 
    174253 
    175254----