Project

General

Profile

MailhandlerSubAddress » History » Version 2

Thomas Guyot-Sionnest, 2010-07-18 02:17
typo

1 1 Thomas Guyot-Sionnest
h1. Mailhandler Frontend for SubAddressing
2
3
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:
4
5
"RFC 3598":http://tools.ietf.org/html/rfc3598
6
"RFC 5233":http://tools.ietf.org/html/rfc5233
7
8
h2. How it works
9
10
The subaddress is separated from the real address using the "+" sign, so for example, the email:
11
<redmine@example.com>
12
will become 
13
<redmine+project@example.com>
14
15
Compatible MTAs will still send these emails to the <redmine@example.com> recipient, and it is up to that recipient to make good use of the subaddress portion.
16
17
The attachment: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.
18
19
h2. Usage
20
21
<pre>Usage: sub-mailhandler.py -h | -e <email> [ -p <project> ] -- <command-line>
22
23
The <command-line> portion is the full rdm-mailhandler.rb command that would
24
normally be executed as the mail handler. The full path to the executable is
25
required. This command should not include a project; use the build-in
26
--project argument instead.
27
28
Options:
29
  -h, --help            show this help message and exit
30
  -e EMAIL, --email=EMAIL
31
                        Known email to look for (i.e. redmine recipient)
32
  -p PROJECT, --project=PROJECT
33
                        Default project to pass to rdm-mailhandler.rb if there
34
                        is no subaddress
35
</pre>
36
37
h2. Example
38
39
Lets say you have this .forward file:
40
41
<pre>"|/home/redmine/rdm-mailhandler.rb --url http://redmine.example.com --project myproject --allow-override project,tracker,category,priority,status --key xxxxxxxxxxxxxxx"</pre>
42
43
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:
44
45
<pre>"|/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"</pre>
46
47 2 Thomas Guyot-Sionnest
Now, you can still send email to <redmine@example.com> and have the default project (and override it). However if you want to send an email for "projectx", then you cen send it to <redmine+projectx@example.com> and the project will be set accordingly.
48 1 Thomas Guyot-Sionnest
49
h2. Credits
50
51
This script and wiki page have been originally written by Thomas Guyot-Sionnest <thomas@gmail.com>