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 almost 8 years ago. Updated almost 8 years ago.

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


Category:Email receiving
Target version:-


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


#1 Updated by Jan Niggemann ( team member) almost 8 years ago

Sounds like a good idea!

#2 Updated by Toshi MARUYAMA over 7 years ago

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

Also available in: Atom PDF