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



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
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. depends on log_type where the output is saved1.5.0
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_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.6.0
enable_syslog0OPTIONAL, if set log errors to syslog, note they are not mailed back to the reporterdeprecated in 1.5.0
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
log_fileemail2trac.logOPTIONAL, can be set to the same values as trac logging1.5.0
log_formatEmailtrac: %(message)sOPTIONAL, can be set to the same values as trac logging1.5.0
log_levelINFOOPTIONAL, can be set to the same values as trac logging1.5.0
log_typesyslogOPTIONAL, can be set to the same values as trac logging1.5.0
mailto_ccOPTIONAL, use this address as CC in mailto line. E.g.,
mailto_link0OPTIONAL, if set then [mailto:reporter] in description
parentdir<directory>OPTIONAL, Is the root directory of all trac projects, see parentdir2.0.0
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 explanation1.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 ,
[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.


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 Tue Dec  5 12:47:04 2006
Subject: Test
MIME-Version: 1.0
Content-Type: text/plain;
List-Id: 8
X-Scanned-By: MIMEDefang 2.56 on
X-Scanned-By: MIMEDefang 2.51 on
X-Scanned-By: MIMEDefang 2.56 on
X-Spam-Level: ***************************** (29.334) BAYES_99,
        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:

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
    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:
      smtp_enabled = true
      smtp_always_cc =
      smtp_server = localhost
      smtp_from =
      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:


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


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


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

For example:

use_textwrap : 40 


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


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


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


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


Same options and meaning as for binhex option above.


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

Permission System

There are two options to choose from:

  1. trac: This will honor the permission set via trac-admin or the web-interface
  2. update_restricted_to_participants: This will only update a ticket if one the following conditions is met:
    • the updater is the ticket reporter
    • the updater is listed in the CC field of a ticket
    • the updater has trac permission to update the ticket

If the update is denied, a new ticket will be generated instead as to not lose the issue


You can control which workflow must be executed when an ticket is updated. Per state you have to associate a workflow, eg:

  • email2trac.conf
    # workflow_<ticket status>: <workflow name>
    workflow_closed: reopen
    workflow_infoneeded: provideinfo
  • trac.ini:
    reopen = closed -> reopened
    reopen.permissions = TICKET_CREATE
    reopen.operations = del_resolution
    provideinfo = infoneeded -> moreinfo
    provideinfo.permissions = TICKET_CREATE = info provided

When a ticket update is received and the state of the ticket is:

  • closed it will execute the reopen workflow.
  • infoneeded it will execute the infoneeded workflow


This variable is set in the [DEFAULT] section of email2trac.conf, eg:

parentdir: /data/trac/oss/projects

debug: 1

project: /data/trac/pbs_python/project

In this example the parent directory is /data/trac/oss/projects. You can override the project directory per section, see section pbs-python. In the above example the project directory for section email-debug is /data/trac/oss/projects/email2trac

With this new feature you can use one script for aliases. Here is an example from sto add iti dot upvdot es

To avoid touching the postfix alias database I'm using addresses of the form trac+PROJECT@mail.domain 
(I have recipient_delimiter = + on the postfix file) and the alias file has an entry like the following:
 * trac: /usr/local/sbin/email2trac-alias

Where /usr/local/sbin/email2trac-alias is a script that does more or less the following:

if [ -f "$parentdir/$EXTENSION/conf/trac.ini" ]; then
  exec /usr/local/bin/run_email2trac --project="$EXTENSION"
exit 67 # Unknown user