Project

General

Profile

MailhandlerSubAddress » History » Revision 2

Revision 1 (Thomas Guyot-Sionnest, 2010-07-14 23:59) → Revision 2/3 (Thomas Guyot-Sionnest, 2010-07-18 02:17)

h1. 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":http://tools.ietf.org/html/rfc3598 
 "RFC 5233":http://tools.ietf.org/html/rfc5233 

 h2. How it works 

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

 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. 

 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. 

 h2. Usage 

 <pre>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 
 </pre> 

 h2. Example 

 Lets say you have this .forward file: 

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

 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: 

 <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> 

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

 h2. Credits 

 This script and wiki page have been originally written by Thomas Guyot-Sionnest <thomas@gmail.com>