Project

General

Profile

Multiple task Creation With Replies on Incomming Mail

Added by Darryn Francesco over 12 years ago

Hi,

I was wondering if anyone has this issue ? I've gotten it right to accept incoming mail to create a task, however with commercial type people being as they are with the reply to all option in mail clients they use it as often as possible.

This is a problem as every time the mail address I used for task creation gets a reply, it creates a new task. Is there some intelligent way to get around this or does one need to write some sort of script to prevent this from happening ?

Thanks in advance ...


Replies (3)

RE: Multiple task Creation With Replies on Incomming Mail - Added by Tony Ordner over 12 years ago

We have the same problem with this sometimes... Unfortunately we have not found a good way to have this handled auto-magically. So we just tag them as duplicates and and close them. I guess the only good thing is that you are not alone in this problem.

wowsher

RE: Multiple task Creation With Replies on Incomming Mail - Added by Diego Suárez García over 12 years ago

Hi guys,

We made a little modification to the core to do this (customized to our specific needs). In the future I'll try to make it a plugin, for ease of use to everyone. In the meantime, I can provide you the code modifications (it's the file app/models/mail_handler.rb)

diff with mail_handler.rb (redmine 1.2) ahead:

--- mail_handler.rb.old 2011-09-26 15:49:21.000000000 +0200
+++ mail_handler.rb     2011-09-26 15:51:21.000000000 +0200
@@ -100,7 +100,17 @@
     elsif m = email.subject.match(MESSAGE_REPLY_SUBJECT_RE)
       receive_message_reply(m[1].to_i)
     else
-      dispatch_to_default
+      #dsuarez: We iterate the recent (15 days) open issues and check if any of them has the same subject than the received mail.
+      recientes = Issue.open.find(:all, :conditions=>['updated_on > ?',15.days.ago], :order=>'updated_on ASC').collect{|x| [x.id, x.subject]}
+      match_incidencia = 0 
+      recientes.each do |pair| 
+        match_incidencia = pair[0] if email.subject.match(/^(re:|rv:|fwd:) #{Regexp.quote(pair[1])}/i)                                                                          
+      end 
+      if match_incidencia !=0 
+         receive_issue_reply(match_incidencia.to_i)
+      else
+       dispatch_to_default
+      end
     end
   rescue ActiveRecord::RecordInvalid => e
     # TODO: send a email to the user

mail_handler.patch (1.03 KB) mail_handler.patch Patch with the code for the mail handling

RE: Multiple task Creation With Replies on Incomming Mail - Added by Tony Ordner over 12 years ago

That is great I look forward to your plug-in! In the meantime I may implement this patch thank you for sharing.

thank you
tony

    (1-3/3)