Project

General

Profile

Actions

Defect #10414

closed

Duplicated Message-Id in headers of mails send by Redmine

Added by Jérôme BATAILLE about 12 years ago. Updated about 7 years ago.

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

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

If a modification is made on the same issue the message Id can be the same :

  def self.message_id_for(object)
    # id + timestamp should reduce the odds of a collision
    # as far as we don't send multiple emails for the same object
    timestamp = object.send(object.respond_to?(:created_on) ? :created_on : :updated_on)
    hash = "redmine.#{object.class.name.demodulize.underscore}-#{object.id}.#{timestamp.strftime("%Y%m%d%H%M%S")}" 
    host = Setting.mail_from.to_s.gsub(%r{^.*@}, '')
    host = "#{::Socket.gethostname}.redmine" if host.empty?
    "<#{hash}@#{host}>" 
  end

the message id is made with the created_on date and not with the updated_on date.
Usually it's more likely that there is a created_on field when there is no updated_on,
and not the opposite.

Here is a fix :

    timestamp = object.send(object.respond_to?(:updated_on) ? :updated_on : :created_on)

Actions

Also available in: Atom PDF