Project

General

Profile

Actions

MailhandlerSubAddress » History » Revision 1

Revision 1/3 | Next »
Thomas Guyot-Sionnest, 2010-07-14 23:59
Original article


Mailhandler Frontend for SubAddressing

When using rdm-mailhandler.rb, one thing that can be very useful is having a single email address to enable multiple projects without having to override the project all the time in the email body. This is possible using the subaddress format as defined in the following RFCs:

RFC 3598
RFC 5233

How it works

The subaddress is separated from the real address using the "+" sign, so for example, the email:
<>
will become
<>

Compatible MTAs will still send these emails to the <> recipient, and it is up to that recipient to make good use of the subaddress portion.

The sub-mailhandler.py script is a front-end for rdm-mailhandler.rb that reads the header of the email, looks for a subaddress and then launches rdm-mailhandler.rb with the specified project, or the default project if specified. It can literally be "inserted" in front of the command line.

Usage

Usage: sub-mailhandler.py -h | -e <email> [ -p <project> ] -- <command-line>

The <command-line> portion is the full rdm-mailhandler.rb command that would
normally be executed as the mail handler. The full path to the executable is
required. This command should not include a project; use the build-in
--project argument instead.

Options:
  -h, --help            show this help message and exit
  -e EMAIL, --email=EMAIL
                        Known email to look for (i.e. redmine recipient)
  -p PROJECT, --project=PROJECT
                        Default project to pass to rdm-mailhandler.rb if there
                        is no subaddress

Example

Lets say you have this .forward file:

"|/home/redmine/rdm-mailhandler.rb --url http://redmine.example.com --project myproject --allow-override project,tracker,category,priority,status --key xxxxxxxxxxxxxxx"

You always have to provide the recipient email, and in this case you would have to move the default project argument to sub-mailhandler.py. Everything else is copied verbatim:

"|/home/redmine/sub-mailhandler.py --email redmine@example.com --project myproject -- /home/redmine/rdm-mailhandler.rb --url http://redmine.example.com --allow-override project,tracker,category,priority,status --key xxxxxxxxxxxxxxx"

Now, you can still send email to <> and have the default project (and override it). However if you wabt to send an email for "projectx", then you cen send it to <> and the project will be set accordingly.

Credits

This script and wiki page have been originally written by Thomas Guyot-Sionnest <>

Updated by Thomas Guyot-Sionnest over 13 years ago · 1 revisions