Patch to the Redmine Mail Handler for overriding the sender, and adding custom header/footers to imported e-mails
- 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 :
- In some cases, override all senders (known and unknown) with a specific user as specified above :
- 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 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@example.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.