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:
How it works¶
Compatible MTAs will still send these emails to the <firstname.lastname@example.org> 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: 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
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 email@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 <firstname.lastname@example.org> and have the default project (and override it). However if you want to send an email for "projectx", then you cen send it to <email@example.com> and the project will be set accordingly.
This script and wiki page have been originally written by Thomas Guyot-Sionnest <firstname.lastname@example.org>