wiki:Email2tracConfiguration

Version 88 (modified by anonymous, 14 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:

NAMEDEFAULT VALUEDescriptionversion
[DEFAULT]REQUIRED
project:/data/trac/jouvinREQUIRED
alternate_notify_templateNoneOPTIONAL if set then use this style sheet for notify. E.g., ticket_alternate
alternate_notify_template_updateNoneOPTIONAL if set then use this style sheet for notify ticket updates. E.g., ticket_alternate_update
applesinglewarnOPTIONAL, Attachments options, default: warndeprecated in 1.1.0
appledoublewarnOPTIONAL, Attachments options, default: warndeprecated in 1.1.0
binhexwarnOPTIONAL, Attachments options, default: warndeprecated in 1.1.0
black_listDrop mail if sender/domain matches. Can have multiple values separated by ,.
debug:0OPTIONAL, if set prints DEBUG info, Note: only use from interactive shell
drop_spam:0OPTIONAL: see Spam configuration
drop_alternative_html_version:0OPTIONAL, if set then drop the HTML part of the message that is t he same as the plain text version
email_header:0OPTIONAL, if set then show TO/CC fields in description
email_comment>OPTIONAL, prefix used to comment original text of ticket when using mailto_link
email_quote>OPTIONAL, if strip_quote is set, then remove email starting with this quote char
email_triggers_workflow1OPTIONAL, If set to 0 it will prevent closed tickets to be reopened or trigger a workflow1.2.0
enable_syslog0OPTIONAL, if set log errors to syslog, note they are not mailed back to the reporter
ignore_trac_user_settings0OPTIONAL, if set it will skip the email address to trac user login name mapping
inline_properties0OPTIONAL, This is used to set ticket fields within an email, see body text parsing1.2.0
mailto_cc:OPTIONAL, use this address as CC in mailto line. E.g., ticket@test.nl
mailto_link:0OPTIONAL, if set then [mailto:reporter] in description
python_egg_cache$PYTHON_EGG_CACHEOPTIONAL, if set use this setting as environment variable; some installations depend on this.
recipient_listIf set then only accept mail when the to-field is in this list, usually only used in a dropbox configuration
reflow1OPTIONAL, if set then soft line breaks will be removed from {{[format:flowed]}} email when creating the ticket with verbatim_format turned off
reply_all:0OPTIONAL, if set then put all CC-addresses in ticket CC-field
spam_level:0OPTIONAL, see Spam configuration
spam_headerX-Spam-ScoreOPTIONAL, see Spam configuration
strip_quotes0OPTIONAL, if set strip quotes from the email, useful when replying to tickets (see also email_quote), default: 0
strip_signature0OPTIONAL, if set try to remove the user signature from the mail, default: 0
subject_field_separator&OPTIONAL. This is used to split the subject line, see Subject field parsing1.1.0
ticket_permission_systemOPTIONAL. Select which Permission System must be used trac or update_restricted_to_participants1.5.0
ticket_update:0OPTIONAL, if set then check if this is an update for a ticket (see below)
ticket_update_by_subject0Optional, When there is no ticket number found in the reply mail. It will try to find a ticket that matches the subject line. Default time 30 days back from time received1.4.0
ticket_update_by_subject_lookback30Optional, see ticket_update_by_subject for explanation 1.4.0
tmpdir/tmpOPTIONAL, if set use this as temporary directory, default: /tmp
trac_version:0.10OPTIONAL, if set then use this as version numberdeprecated in 1.4.0
umask:process's umaskOPTIONAL, if set use this umask for saving attachments. E.g., 022.
use_textwrap0OPTIONAL, if set wrap text lines longer then the indicated number of characters. A value of 0 disables wrapping.
verbatim_format1OPTIONAL, default: 1, if unset then do not use format: {{{ mail body text }}]
white_listIf set only accept mail when sender matches. Can have multiple values separated by ,
FURTHER ENTRIESEXAMPLE VALUEDESCRIPTION
[bas]OPTIONAL next project declaration, also set project and use --project option
project:/data/trac/baspath to Trac project bas
spam_level:2Override 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
    

NOTE: For versions prior to 1.1.0 the subject field separator is , instead of &

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.

Attachments options

Versions greater then 1.0.0 you can specify which attachments are saved or dropped, via:

  • strip_content_types

The following configuration will drop pgp signature attachments and apple binhex40 attachments:

  • strip_content_types: application/pgp-signature, application/mac-binhex40

The following option will be deprecated in a newer version of email2trac. For now it can be used as backward compatible option for the apple attachments. These options will set the parameter strip_content_types to drop these kind of attachments. So the option warn does not exists anymore:

  • binhex
  • applesingle
  • appledouble

Version less or equal to 1.0.0

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'.