プロジェクト

全般

プロフィール

Vote #75284

完了

Issue emails cannot be threaded by some mailers due to inconsistent Message-ID and References field

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Email notifications_9
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
9
version_id:
127
issue_org_id:
17096
author_id:
11192
assigned_to_id:
332
comments:
25
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
79
ステータス-->[Closed]

説明

h2. Redmine 1.4:

h3. Issue adding:

Message-Id: 

h3. Issue editing:

Message-Id: 
References: 

h2. Redmine 2.4:

h3. Issue adding:

Message-ID: 
References: 

h3. Issue editing:

Message-ID: 
References: 

Redmine 2.4 issue adding "Message-ID" and editing "References" are not equal.

So, some mailers cannot thread issue mails.


journals

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Behavior changed by #5037 r12012.

test/unit/mailer_test.rb

<pre><code class="diff">
@@ -231,19 +231,21 @@
end

def test_issue_add_message_id
- issue = Issue.find(1)
- Mailer.issue_add(issue).deliver
+ issue = Issue.find(2)
+ Mailer.deliver_issue_add(issue)
mail = last_email
- assert_equal Mailer.message_id_for(issue), mail.message_id
- assert_nil mail.references
+ assert_match /^redmine\.issue-2\.20060719190421\.[a-f0-9]+@example\.net/, mail.message_id
+ assert_include "redmine.issue-2.20060719190421@example.net", mail.references
end

def test_issue_edit_message_id
- journal = Journal.find(1)
- Mailer.issue_edit(journal).deliver
+ journal = Journal.find(3)
+ journal.issue = Issue.find(2)
+
+ Mailer.deliver_issue_edit(journal)
mail = last_email
- assert_equal Mailer.message_id_for(journal), mail.message_id
- assert_include Mailer.message_id_for(journal.issue), mail.references
+ assert_match /^redmine\.journal-3\.\d+\.[a-f0-9]+@example\.net/, mail.message_id
+ assert_include "redmine.issue-2.20060719190421@example.net", mail.references
assert_select_email do
# link to the update
assert_select "a[href=?]",
</code></pre>
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
This is patch to fix.
--------------------------------------------------------------------------------
This is new patch.
In note 6 patch, mail receiver can guess user id.
--------------------------------------------------------------------------------
As far as I can see, this patch only works if the same users are notified during all the issue thread. But this is not the case.
--------------------------------------------------------------------------------
Jean-Philippe Lang wrote:
> As far as I can see, this patch only works if the same users are notified during all the issue thread. But this is not the case.

Yes, it is same behavior before #5037.

Note-7 patch message id:

Issue adding:

<pre>
Message-ID: <redmine.issue-72.20140627064350.1ebc022e@example.net>
</pre>

Issue editing:

<pre>
Message-ID: <redmine.journal-142.20140627064557.1ebc022e@example.net>
References: <redmine.issue-72.20140627064350.1ebc022e@example.net>
</pre>

--------------------------------------------------------------------------------
No it's not the same behaviour as before #5037. Before #5037, we always had a single email notification, the first message-id and all references were fixed, eg. @<redmine.issue-72.20140627064350@example.net>@.

With the patch in note-7 applied, the references header changes if a new custom field is added or if you change the permissions on custom fields. And that breaks all the thread. Exemple:

Issue creation:

<pre>
Message-ID: <redmine.issue-16507.20140705102246.3ecc5e01@redmine.org>
</pre>

First update (OK):

<pre>
Message-ID: <redmine.journal-55676.20140705102328.3ecc5e01@redmine.org>
References: <redmine.issue-16507.20140705102246.3ecc5e01@redmine.org>
</pre>

After adding a new custom field, you get:

<pre>
Message-ID: <redmine.journal-55677.20140705102736.49bb14f7@redmine.org>
References: <redmine.issue-16507.20140705102246.49bb14f7@redmine.org>
</pre>

--------------------------------------------------------------------------------
Jean-Philippe Lang wrote:
> With the patch in note-7 applied, the references header changes if a new custom field is added or if you change the permissions on custom fields. And that breaks all the thread.

Yes. But, it keeps while custom field condition.
In other case before #5037, if user not get issue creating mail, then by watching user get issue editing mail, mail thread is broken on some mailer.

This issue is mail thead broken on some mail in spíte of getting issue creating mail and not changing custom field condition.
--------------------------------------------------------------------------------
#1401#note-11
> Do you have a documentation about that ?

* http://comments.gmane.org/gmane.comp.version-control.mercurial.devel/70052
** http://www.jwz.org/doc/threading.html
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Hi,

are there any news on this? I am having problems with my notification mails, too and would love to see that fixed.
--------------------------------------------------------------------------------

> are there any news on this? I am having problems with my notification mails, too and would love to see that fixed.

Yeah is gmail related to this? Having troubles too.
--------------------------------------------------------------------------------
I think that adding consistent Message-Id and References filed will be easier if per user notification sending is implemented by #26791. We don't have to use random_hex in Mailer.token_for method. Instead, we can use EmailAddress#id or some hash value generated from an email address.

The following is an example of the idea.

*Issue adding:*

<pre>
Message-Id: <redmine.issue-#{object.id}.#{timestamp}.#{email_address.id}@example.net>
</pre>

*Issue editing:*

<pre>
Message-Id: <redmine.journal-#{object.id}.#{timestamp}.#{email_address.id}@example.net>
References: <redmine.issue-#{object.id}.#{timestamp}.#{email_address.id}@example.net>
</pre>
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Go MAEDA wrote:
> I think that adding consistent Message-Id and References filed will be easier if per user notification sending is implemented by #26791. We don't have to use random_hex in Mailer.token_for method. Instead, we can use EmailAddress#id or some hash value generated from an email address.

I wrote a patch.

In Redmine 3.4, Redmine may generate multiple notification messages and each message is sent to multiple recipients grouped by custom fields visibility. For example, if there are 6 recipients and they are grouped to 3 groups by custom fields visibility, Redmine generates 3 messages and then pass those to a mail server. Of course, each message has 2 recipients.

Since multiple messages are generated at once when updating one issue, Redmine adds a random key to the message-id to ensure the message-id is unique. Because the random key is never stored, Redmine cannot reproduce the message-id generated in the past and cannot set exact id to the References field in the notification message when the issue is updated. This is why emails are not properly threaded.

In the latest Redmine 4.0, one message is always sent to one recipient. Since one message is never addressed to multiple recipients, we can use recipient user information like user_id. If we use user_id instead of a random key to make a unique message-id, we can set the correct and exact value to References field in the message when the issue is updated because message ids generated in the past is always reproducible. By doing that, emails should be threaded properly.

The attached patch uses user_id to generate unique message-ids.

*Issue added:*

<pre>
Message-Id: <redmine.issue-#{issue.id}.#{issue.created_on}.#{user_id}@example.net>
</pre>

*Issue updated:*

<pre>
Message-Id: <redmine.journal-#{jounal.id}.#{journal.created_on}.#{user_id}@example.net>
References: <redmine.issue-#{issue.id}.#{issue.created_on}.#{user_id}@example.net>
</pre>
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Updated the patch to apply cleanly to the current trunk (r17913).
--------------------------------------------------------------------------------
Setting the target version to 4.1.0.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Committed the patch. The new Message-ID formats are as follows:

Issue added:

<pre>
Message-Id: <redmine.issue-#{issue.id}.#{issue.created_on}.#{user_id}@example.net>
</pre>

Issue updated:

<pre>
Message-Id: <redmine.journal-#{jounal.id}.#{journal.created_on}.#{user_id}@example.net>
References: <redmine.issue-#{issue.id}.#{issue.created_on}.#{user_id}@example.net>
</pre>
--------------------------------------------------------------------------------


related_issues

relates,Closed,5037,Role-based issue custom field visibility
relates,Closed,26791,Send individual notification mails per mail recipient
relates,Closed,13111,New setting to include the status changes in issue mail notifications subject

Admin Redmine さんが3年以上前に更新

  • カテゴリEmail notifications_9 にセット
  • 対象バージョン4.1.0_127 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0