Feature #31107

How to disable email subject processing

Added by Daniel Arnost over 2 years ago. Updated about 2 years ago.

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

0%

Category:Email receiving
Target version:-
Resolution:

Description

Hello!
We run redmine 2.4.2 and use rdm-mailhandler. It works well until new email arrives with subject containing "[#123"]. This string mostly does not belong to redmine issue - it is from another ticket system and we need always to create new issue from that email. Unfortunately, as is written, the email is processed as a reply for [#123]. And if redmine can not find existing issue #123, email is returned and no new issue is created.

Is any chance to disable this email subject processing for selected project/mail-handler?

Thanks,
dan

History

#1 Updated by Go MAEDA over 2 years ago

There is no option to disable the feature that adds replies in the mail handler, but maybe you can remove the feature by changing the code as follows.

diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index 52faef135..f721a2314 100755
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -168,10 +168,6 @@ class MailHandler < ActionMailer::Base
       else
         # ignoring it
       end
-    elsif m = subject.match(ISSUE_REPLY_SUBJECT_RE)
-      receive_issue_reply(m[1].to_i)
-    elsif m = subject.match(MESSAGE_REPLY_SUBJECT_RE)
-      receive_message_reply(m[1].to_i)
     else
       dispatch_to_default
     end

#2 Updated by Daniel Arnost over 2 years ago

  • Status changed from New to Resolved

Ok, I will try it. Thanks and regards.

#3 Updated by Christof Egner about 2 years ago

Hello,

I would suggest the following changes to the code in order to make redmine ignore alien issue id:

172c172,178
<       receive_issue_reply(m[1].to_i)
---
>       issue = Issue.find_by_id(m[1].to_i)
>       if issue
>         receive_issue_reply(issue.id)
>       else
>         logger.error "MailHandler: Invalid issue id ##{m[1].to_i}; dispatch_to_default" if logger
>         dispatch_to_default
>       end

Christof

Also available in: Atom PDF