Project

General

Profile

Actions

Feature #23011

closed

Purpose of MESSAGE_ID_RE in mail_handler.rb

Added by Alexander Herr over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

In `dispatch` of `app/models/mail_handler.rb` a global named `MESSAGE_ID_RE` is used, which is defined as the regular expression:

MESSAGE_ID_RE = %r{^<?redmine\.([a-z0-9_]+)\-(\d+)\.\d+(\.[a-f0-9]+)?@}

The conditional in `dispatch` does the following:

if headers.detect {|h| h.to_s =~ MESSAGE_ID_RE}
      klass, object_id = $1, $2.to_i
      method_name = "receive_#{klass}_reply" 
      if self.class.private_instance_methods.collect(&:to_s).include?(method_name)
        send method_name, object_id
      else
        # ignoring it
      end
end

The purpose of this global (and its conditional in `dispatch`) isn't quite clear to me, as it is also lacking comments. I suspect that it looks for redmine's own e-mail-address and then calls a supplied method?

Why should redmine talk to itself through e-mails in such a way? What if I change redmine's e-mail-address to something not containing redmine? What will break (if anything)?

We recently changed the naming of our redmine instance (both the domain-name and the e-mail-address now do not contain redmine) to something more obvious for non-tech folk. We would hate to have broken something by that change.

Actions

Also available in: Atom PDF