Patch #19242

Patch to the Redmine Mail Handler for overriding the sender, and adding custom header/footers to imported e-mails

Added by Stephane Lapie over 2 years ago. Updated over 2 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Email receiving
Target version:-

Description

Following #19182 and experimenting with the Redmine Mail Handler, for use within my company, we ended up with the following need :
  • In some cases, accept both known senders and unknown senders, but we did not want to allow AnonymousUser to be used, so we needed to override the sender with a specific user :
    --post-user SENDER
    
  • In some cases, override all senders (known and unknown) with a specific user as specified above :
    --override-sender YES/NO
    
  • Since we are overriding the sender, and we did not want to lose this information, we opted to allow the command-line rdm-mailhandler.rb script to take custom headers and footers for the imported mail body (to be added right after the cleanup process so as to minimize interference) :
    --email-header TEXT
    --email-footer TEXT
    
The patch included adds :
  • the above options to extra/mail_handler/rdm-mailhandler.rb
  • the code to process them within app/models/mail_handler.rb

Right now we are using these options in this fashion (this is used on top of the patch from #19182), in a script called as destination for e-mail coming from the outside :

/usr/local/share/redmine-2.5/extra/mail_handler/rdm-mailhandler.rb -v \
    --override-sender yes \
    --post-user yuubinkyoku@internal.domain.com \
    --email-header "Mail sent by : $SENDER" \
    --certificate-bundle /etc/ssl/certs/ca-certificates.crt \
    --url https://$URL/ \
    --key $API_KEY \
    --project $LOCAL

SENDER, LOCAL are variables set by Postfix upon calling the aforementioned script.
URL and API_KEY are derived from the DOMAIN variable and are not relevant to this example.

patch-rdm-mailhandler-options.patch Magnifier (5.8 KB) Stephane Lapie, 2015-03-03 03:56


Related issues

Related to Redmine - Feature #19182: Patch to the Redmine Mail Handler for specifying a custom... Closed

History

#1 Updated by Jan Niggemann (redmine.org team member) over 2 years ago

Sounds like a good idea!

#2 Updated by Toshi MARUYAMA over 2 years ago

  • Related to Feature #19182: Patch to the Redmine Mail Handler for specifying a custom CA bundle added

Also available in: Atom PDF