5 | | provides a command line script and extension point that allows email messages to be handled by Trac plugins |
| 5 | provides a command line script and extension point that allows email messages to be handled by Trac plugins. This ticket provides a command-line script, `mail2trac` which may be called by an [http://en.wikipedia.org/wiki/Mail_transfer_agent MTA] (e.g. [http://www.postfix.org/ postfix]) to open a Trac environment and run through each enabled [source:mailtotracplugin/0.11/mail2trac/interface.py IEmailHandler] and executes its `invoke()` method if its `match()` method returns `True`. If invoke returns an [http://docs.python.org/library/email email] message, then subsequent `IEmailHandler`s will also process the message. If `None` is returned, then the message is consumed and execution stops. |
| 6 | |
| 7 | To enable the plugin for `postfix`, add an appropriate line to the aliases file (usually `/etc/aliases` or `/etc/postfix/aliases` and then refreshing the aliases database (see [http://www.postfix.org/aliases.5.html man aliases]). The `mail2trac` script takes a `-p` command line argument for the path to the project environment. The incoming email address should equal |
| 8 | |
| 9 | {{{ |
| 10 | [notification] |
| 11 | smtp_replyto = |
| 12 | }}} |
| 13 | |
| 14 | in the [http://trac.edgewall.org/wiki/TracIni trac.ini] file. |
| 15 | |
| 16 | As an example, if `smtp_replyto` is set to `foo@example.com` and the project is in `/var/trac/bar`, the `aliases` file on `example.com` should have a line like |
| 17 | |
| 18 | {{{ |
| 19 | foo: "|/path/to/mail2trac -p /var/trac/bar" |
| 20 | }}} |
| 21 | |