wiki:Email2tracMta

Version 17 (modified by egi@…, 17 years ago) (diff)

--

Mail server configuration

It depends on your Mail Transfer Agent (MTA) how the setup.

Postfix

The procedure is:

  • Edit your alias definition file (default : /etc/aliases) for Postfix and add one line per project you want to allow ticket submission from email to. For each alias you can specify:
    • --project: This option selects a configuration stanza in the config file
    • --component: To specify a component other than the default component for the project.
     tracproj: |"/usr/bin/run_email2trac [--project=<name>] [--component=<component>]"

  • Update your alias database with command newaliases

Note for postfix

run_email2trac is totally unnecessary for Postfix. You can run a delivery command as any user just by placing the aliases in a separate file and chowning that aliases file to the user you want the delivery to run as. Then you run postalias /path/to/aliases, which will create /path/to/aliases.db, and you then just add hash:/path/to/aliases to the alias_maps config variable in main.cf.

The only caveat is that the user who owns the separate aliases file needs to have write perms to the directory that it's stored in (which rules out putting it in /etc/postfix unless you're nuts) -- mpalmer@….

Sendmail

The procedure is:

  • Edit your alias definition file (default : /etc/mail/aliases) for Sendmail and add one line per project you want to allow ticket submission from email to. For each alias you can specify:
    • --project: This option selects a configuration stanza in the config file
    • --component: To specify a component other than the default component for the project.
     tracproj: "|/usr/bin/run_email2trac [--project=<name>] [--component=<component>]"
  • Update your alias database with command newaliases

Note for Sendmail

This is a message from emailtotrac tickets archive:

Sendmail limits the executables that can be run via aliases to those in a
special directory, and runs them using a restricted shell called smrsh.
On RH, the default location for the allowed programs is /etc/smrsh.

I tried both a link in that dir to the run_email2trac file and a little
shell script that simply calls run_email2trac and passes the params. Both
should work, but neither did yet. Majordomo works the same way, and it
set up on the machine already so I'll check on that later today.

I found a pretty good walk-through of the problem/solution at
http://archives.free.net.ph/message/20030605.105120.74c3bfa8.html

Well, I was in fact doing the right thing. Here's all the steps to follow
post make install

ln -s /usr/local/bin/run_email2trac /etc/smrsh/run_email2trac

in aliases use:

"|run_email2trac -project=bas"

Note: Include the quotes, they are necessary. That got me past the
sendmail problem. No ticket appeared in the project, but I'll look into
that next. Is there a log generated anywhere?

Exim Setup

As with Postfix, run_email2trac is unnecessary. Instead of editing the /etc/aliases file, one must create a router and a transport. My own Debian-compatible configs follow. Slight modification should make them usable for you.

theblackbox:/etc/exim4/conf.d# cat router/101_exim4-config_trac_gw
trac_router:
  driver = accept
  require_files = /usr/local/bin/email2trac
  local_parts = support
  transport = trac_transport

theblackbox:/etc/exim4/conf.d# cat transport/30_exim4-config_trac
trac_transport:
  driver = pipe
  command = /usr/local/bin/email2trac
  current_directory = /tmp
  home_directory =  /tmp
  user = www-data
  group = www-data
theblackbox:/etc/exim4/conf.d#

-- alexander (here insert a squiggly 'at' thing) garden.msbx.net

Fetchmail Setup

For those of you that installed the mail server on a different server than the subversion/trac server, you might want to use fetchmail instead. I have succeeded by simply set the mda value in /etc/fetchmailrc to run_email2trac

mda "/usr/local/bin/run_email2trac"

you need to specify mta_user to fetchmail user when you configure email2trac previously.

Test Setup

In the source distribution there is a file msg.txt. You can use this file to test the mail configuration:

  • Test with a command like :
         mail tracproj < msg.txt 
    

If this fails then check if it is a mail setup error or an email2trac error:

email2trac --project=tracproj < msg.txt 

If this command succeeds then it is a mail setup error, else we get an error to stdout or syslog, depends on you email2trac.conf setup.