wiki:Email2tracConfiguration

Version 44 (modified by bas, 13 years ago) (diff)

--

Configuration

After installation, edit email2trac.conf for your site. The most important parameter is project. Below is a table of options with short descriptions and their default value:

NAME DEFAULT VALUE Description
[DEFAULT] REQUIRED
project: /data/trac/jouvin REQUIRED
debug: 0 OPTIONAL, if set print some DEBUG info
spam_level: 0 OPTIONAL, if set check for SPAM mail
drop_spam: 0 OPTIONAL:, if set then reject mail marked as SPAM
reply_all: 0 OPTIONAL, if set then put all CC-addresses in ticket CC-field
umask: process's umask OPTIONAL, if set use this umask for saving attachments. E.g., 022.
mailto_link: 0 OPTIONAL, if set then [mailto:reporter] in description
mailto_cc: OPTIONAL, use this address as CC in mailto line. E.g., ticket@test.nl
ticket_update: 0 OPTIONAL, if set then check if this is an update for a ticket (see below)
email_header: 0 OPTIONAL, if set then show TO/CC fields in description
trac_version: 0.10 OPTIONAL, if set then use this as version number
alternate_notify_template None OPTIONAL if set then use this style sheet for notify. E.g., a_ticket.css
enable_syslog 0 OPTIONAL, if set log errors to syslog, note they are not mailed back to the reporter
verbatim_format 1 OPTIONAL, default: 1, if unset then do not use format: {{{ mail body text }}]
strip_signature 0 OPTIONAL, if set try to remove the user signature from the mail, default: 0
use_textwrap 0 OPTIONAL, if set wrap text lines longer then the indicated number of characters. A value of 0 disables wrapping.
python_egg_cache $PYTHON_EGG_CACHE OPTIONAL, if set use this setting as environment variable; some installations depend on this.
tmpdir /tmp OPTIONAL, if set use this as temporary directory, default: /tmp
email_comment > OPTIONAL, prefix used to comment original text of ticket when using mailto_link
ignore_trac_user_settings 0 OPTIONAL, if set it will skip the email address to trac user login name mapping
FURTHER ENTRIES EXAMPLE VALUE DESCRIPTION
[bas] OPTIONAL next project declaration, also set project and use --project option
project: /data/trac/bas path to Trac project bas
spam_level: 2 Override DEFAULT spam_level for project bas. All above settings also can be set for project bas.

Spam

There are two configuration options to handle spam. Both options depend on the X-Spam-Score line in the message header. This line is set by a spam detecting program like SpamAssassin. Email2trac counts the number of * characters in the X-Spam-Score line.

For example, with the configuration:

spam_level: 4
drop_spam: 1   

Email2trac drops all email with Spam-score greater the 4. Given this setting, an email with the below header is rejected:

From lijuydru@example.com Tue Dec  5 12:47:04 2006
To: test@example.com
Subject: Test
MIME-Version: 1.0
Content-Type: text/plain;
List-Id: 8
X-Scanned-By: MIMEDefang 2.56 on 145.100.16.144
X-Scanned-By: MIMEDefang 2.51 on 145.100.16.26
X-Scanned-By: MIMEDefang 2.56 on 145.100.16.144
X-Spam-Score: ***************************** (29.334) BAYES_99,
        HELO_DYNAMIC_DHCP,HELO_DYNAMIC_IPADDR,MSGID_FROM_MTA_ID,
        RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_SORBS_DUL,RCVD_IN_XBL,
        SUBJ_ILLEGAL_CHARS, URIBL_JP_SURBL, URIBL_SBL, URIBL_SC_SURBL,
        WEIRD_PORT, autolearn=spam

Default values for ticket fields

In email2trac.conf you can specify the default values for the ticket fields. This can be different then the one's specified in trac.ini. email2trac will process the files in this order:

  1. email2trac.conf
  2. trac.ini

The format is the same as for trac.ini, eg:

[test_project]
default_component : test
default_version : 0.20

Email2trac check if the given values are allowed for this field. If it is not allowed then the trac.ini default value is used.

Multiple email addresses setup

When there are more then one email adress to the same project. You can configure it to have different default values for a ticket, eg:

  • /etc/aliases
    support: |"/usr/local/bin/run_email2trac --project=test --ticket_prefix=support"
    devel:   |"/usr/local/bin/run_email2trac --project=test --ticket_prefix=devel"
    
  • /usr/local/etc/email2trac.conf
    [test]
    support_component = support
    devel_component = devel
    

Ticket Update

If you have enabled ticket_update in email2trac.conf then you have to configure one of the two options explained below. Email2trac will scan the subject field of all emails to determine if a given email is a ticket update, and consequently it must update ticket fields.

For example:

  • This subject line will trigger an update of ticket number 1529:
    Subject: [hic] #1529: Re: LRZ
    
  • The following subject line will trigger an update of ticket number 1529 and will set its owner to bas and priority to medium:
    Subject: [hic] #1529?owner=bas,priority=medium: Re: LRZ
    

Email address

This is the preferred method. This will setup an email address where the ticket information will be sent to. This is a different email address than the ticket email address. When you reply on this email a copy will be sent to the ticket email address.

Here is an example setup for the trac.ini of the respective trac project:

      (ticket address: ticket@test.nl)
      [notification]
      smtp_enabled = true
      smtp_always_cc = test@test.nl
      smtp_server = localhost
      smtp_from =  ticket@test.nl
      always_notify_reporter = true

smtp_always_cc is the address where the ticket information is sent to and smtp_from is the ticket email address. So if somebody replies a copy of the ticket is sent to this address.

html code

Use the mailto_cc and mailto_link in email2trac.conf. This will add a html mailto link in the description field. If you click on this link it will open the default mail program which will send an email to the reporter and Carbon Copy to the ticket address.

Formatting options

There are several options that control the behaviour of the format of a ticket. Below there is a brief explanation of the options:

verbatim_format::

By default, this option is enabled. When mail is inserted in the

trac ticket system the message's body is inserted as plain text in between {{{ ''body_text'' }}}. Thus, Trac does not process the body text. You can disable this option in email2trac.conf:

verbatim_format : 0

strip_signature::

When enabled it will try to strip the signatures from the email.

It scans the message for a line containing the string --. All lines after this line will be skipped.

strip_signature : 1

use_textwrap::

When enabled it will break lines greater then the the number specified.

For example:

use_textwrap : 40 

input:

This is an example of a line that has more than 40 characters

output:

This is an example of a line that has
more than 40 characters