wiki:Email2tracConfiguration

Version 66 (modified by bas, 15 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
spam_header X-Spam-Score OPTIONAL, Check this email header field for SPAM
drop_spam: 0 OPTIONAL:, if set then reject mail marked as SPAM
black_list Drop mail if sender/domain matches. Can have multiple values separated by ,.
white_list If set only accept mail when sender matches. Can have multiple values separated by ,
recipient_list If set then only accept mail when the to-field is in this list, usually only used in a dropbox configuration
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., ticket_alternate
alternate_notify_template_update None OPTIONAL if set then use this style sheet for notify ticket updates. E.g., ticket_alternate_update
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 }}]
reflow 1 OPTIONAL, if set then soft line breaks will be removed from {{[format:flowed]}} email when creating the ticket with verbatim_format turned off
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
binhex warn OPTIONAL, Apple Attachments options, default: warn
applesingle warn OPTIONAL, Apple Attachments options, default: warn
appledouble warn OPTIONAL, Apple Attachments options, default: warn
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 three configuration options to handle spam. One of the options specifies which header field we must check to determine if a message is SPAM. The default value is X-Spam-Score . The other options depend on this setting and will check the contents of this header field. The header field is set by SPAM detecing program like SpamAssassin. Email2trac counts the number of * characters in the spam_header line.

For example, with the configuration:

spam_level: 4
drop_spam: 1   
spam_header: X-Spam-Level

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-Level: ***************************** (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 address 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 behavior 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

reflow::

Most email clients wrap long lines to <80 characters. In some cases, this breaks Trac wiki formatting (when verbatim_format is off). For example:

  * This is a very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long list item

may get incorrectly rendered as

  • This is a very very very very very very very very very very very very

very very very very very very very very very very very very very very very very very very very very long list item

Format=flowed property of plain-text email, specified in RFC 3676, deals with this problem.

Apple Attachments options

binhex

The BinHex encoding format is deprecated (in favor of AppleDouble MIME, see RFC 1740), but some older clients might still be using it. A file encoded with BinHex is annoying to decode unless you are on a Mac.

The binhex option can be set to one of:

  • 'keep', in which case attachments encoded with BinHex will be included in the ticket
  • 'warn', in which case attachments encoded with BinHex will be ignored, but a warning message to that effect will be included in the ticket description
  • 'drop', in which case attachments encoded with BinHex will be silently ignored

The default is 'warn'.

applesingle

Same options and meaning as for binhex option above.

appledouble

The AppleDouble encoding format is the recommended way to include Mac-specific data in a MIME message, as per RFC 1740. A file encoded with AppleDouble can easily be presented usefully on all platforms.

The applesingle option can be set to one of:

  • 'keep', in which case both the platform-neutral data and the Mac-specific data will be included in the ticket (as two separate attachments)
  • 'warn', in which case only the platform-neutral file data will be included in the ticket. Mac-specific data will be left out, but a warning message will be included in the ticket description.
  • 'strip', in which case only the platform-neutral file data will be included in the ticket. Mac-specific data will be left out with no warning.

The default is 'warn'.