Project

General

Profile

Actions

Feature #2746

closed

Send out issue priority in the email notification header

Added by Brad Beattie about 15 years ago. Updated 4 months ago.

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

0%

Estimated time:
Resolution:
Fixed

Description

The attached patch will send out an issue's priority with the notification email's headers. This is important for when you want to route urgent tickets differently.


Files

priority.patch (938 Bytes) priority.patch Brad Beattie, 2009-02-13 19:10
2746.patch (2.82 KB) 2746.patch Go MAEDA, 2021-05-16 14:19
0001-Add-X-Redmine-Issue-Priority-headers-to-issue-notifi.patch (1.17 KB) 0001-Add-X-Redmine-Issue-Priority-headers-to-issue-notifi.patch Holger Just, 2023-05-04 16:21

Related issues

Related to Redmine - Feature #19939: New X-Redmine-Issue-Priority header, and modification of X-Redmine-Issue-AssigneeNew

Actions
Related to Redmine - Feature #12864: If ticket was created with priority High/Urgent, send smtp-email with priority UrgentClosed

Actions
Related to Redmine - Feature #31910: Add additional mail headers for issue trackerClosedGo MAEDA

Actions
Has duplicate Redmine - Feature #20443: Add Priority header to Email notificationsClosed

Actions
Actions #1

Updated by Jean-Philippe Lang about 15 years ago

Why not use the more standard X-Priority header?

Actions #2

Updated by Brad Beattie about 15 years ago

  • Assignee set to Jean-Philippe Lang

Jean-Philippe Lang wrote:

Why not use the more standard X-Priority header?

Hrm. The header Priority has values "normal", "urgent" and "non-urgent". I can't find any RFC that defines the values of "X-Priority", but most examples I see use the values 1 through 5. While this maps up to Redmine's default priority values, other systems might have limited or extended these enumerations (e.g. my company uses "Low, Normal and Emergency". How would these modified values be mapped to X-Priority? 1, 3, 5? It's kinda vague, yeah?

I guess that's why I thought just creating a Redmine-specific priority header would be a better choice. What're your thoughts on this?

Actions #3

Updated by Jean-Philippe Lang about 15 years ago

An other problem is that a X-Priority of 1 means urgent, whereas Redmine priorities are sorted in opposite order (1 = low).
We need to map Redmine priorities (max => 1, min => 5). Just need to retrieve the total numbers of priorities defined in Redmine.
So yes, if you have 3 priorities defined in Redmine, they would be mapped to X-Priority 1, 3 and 5.

Actions #4

Updated by Thomas Pihl about 15 years ago

Other solution might be an extra field when defining priorities where you can choose x-priority manually for each priority. This might include an option not to send email for some priorities.

/T

Actions #5

Updated by Jean-Philippe Lang about 15 years ago

I'd really prefer not to add an extra field just for this purpose.
Is there any problem with the solution I propose?

Actions #6

Updated by Brad Beattie about 15 years ago

Jean-Philippe Lang wrote:

I'd really prefer not to add an extra field just for this purpose.
Is there any problem with the solution I propose?

Hrm. Yeah. Let's say we have two Redmine instances: one has priorities deferrable and normal, the other has priorities normal and emergency. How would you propose those two instances would be mapped? I don't see a way of automating this to ensure that any set of customized priorities get mapped properly to the X-Priority header. I guess that's why I suggested a Redmine-specific header.

Actions #7

Updated by Go MAEDA over 8 years ago

  • Has duplicate Feature #20443: Add Priority header to Email notifications added
Actions #8

Updated by Go MAEDA over 8 years ago

  • Related to Feature #19939: New X-Redmine-Issue-Priority header, and modification of X-Redmine-Issue-Assignee added
Actions #9

Updated by Peter Volkov over 6 years ago

Guys what's left to do here? Can we have X-Redmine-Priority field at least and leave a question if we need standard Priority field and mapping for better times?

Actions #10

Updated by Go MAEDA over 5 years ago

  • Related to Feature #12864: If ticket was created with priority High/Urgent, send smtp-email with priority Urgent added
Actions #11

Updated by Go MAEDA over 4 years ago

  • Related to Feature #31910: Add additional mail headers for issue tracker added
Actions #12

Updated by Go MAEDA almost 3 years ago

  • Assignee deleted (Jean-Philippe Lang)

The following patch adds a standard Priority field defined in RFC 2156. The priority values are mapped to one of "normal", "urgent", or "non-urgent".

diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index f58a1c88d..33b82a519 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -71,6 +71,7 @@ class Mailer < ActionMailer::Base

   # Builds a mail for notifying user about a new issue
   def issue_add(user, issue)
+    headers['Priority'] = priority_for_header(issue)
     redmine_headers 'Project' => issue.project.identifier,
                     'Issue-Tracker' => issue.tracker.name,
                     'Issue-Id' => issue.id,
@@ -103,6 +104,7 @@ class Mailer < ActionMailer::Base
   # Builds a mail for notifying user about an issue update
   def issue_edit(user, journal)
     issue = journal.journalized
+    headers['Priority'] = priority_for_header(issue)
     redmine_headers 'Project' => issue.project.identifier,
                     'Issue-Tracker' => issue.tracker.name,
                     'Issue-Id' => issue.id,
@@ -763,6 +765,17 @@ class Mailer < ActionMailer::Base
     h.each {|k, v| headers["X-Redmine-#{k}"] = v.to_s}
   end

+  def priority_for_header(issue)
+    position_name = issue.priority.position_name
+    if position_name.start_with?('high')
+      'urgent'
+    elsif position_name.start_with?('low')
+      'non-urgent'
+    else
+      'normal'
+    end
+  end
+
   # Singleton class method is public
   class << self
     def token_for(object, user)
Actions #13

Updated by Go MAEDA almost 3 years ago

Added test code to #2746#note-12.

Actions #14

Updated by Go MAEDA almost 3 years ago

  • Target version changed from Candidate for next major release to 5.0.0

Setting the target version to 5.0.0.

Actions #15

Updated by Go MAEDA almost 3 years ago

  • Target version changed from 5.0.0 to Candidate for next major release

Go MAEDA wrote:

The following patch adds a standard Priority field defined in RFC 2156. The priority values are mapped to one of "normal", "urgent", or "non-urgent".

I found that it is not appropriate to use the Priority header to express issue priorities because the header is related to QoS control of mail delivery. RFC2076 says the header "can influence transmission speed and delivery".

Since issue priority has nothing to do with mail delivery priority, it is wrong to use the Priority header to express issue priority.

Actions #16

Updated by Holger Just 10 months ago

The discussion git a bit derailed from the original request here.

I think the consent now is to just sent the configured priority name as an additional header. For that, I have attached an updated patch which was extracted from Planio. To resolve this issue, we could just apply this patch which is a nice low-friction addition.

Further trying to map this to the value to the "standard" X-Priority / Priority fields in mails could then be an additional step. However, this is something that some people may not want and it is something which has wildly differing support in the MTAs and MUAs with various headers allowing different values and slightly differing semantics.

From my (limited) research, the most common headers are:

  • Priority - Allows the values Non-Urgent, Normal, Urgent
  • X-Priority - Allows the numeric values 1 - 5 with lower numbers indicating higher priorities. Outlook only emits 1, 3 and 5 respectively.
  • Importance - This appears to be a "Microsoft standard". It allows the values Low, Normal, High

Microsoft / Outlook map their internal importance value to all of these header values.

If so desired, we could set one or all of these headers based on the result of IssuePriority#low? or IssuePriority#high?. However, I don't believe this is particularly useful, as it still just reflects the priority of the issue overall, not the priority of the respective notification. As such, I'd rather vote for just adding the name of the priority in the X-Redmine-Issue-Priority header as implemented by the attached patch and not attempt to deduct a mail priority / importance from that.

Related documentation:

Actions #17

Updated by Go MAEDA 10 months ago

  • Target version changed from Candidate for next major release to 5.1.0

Setting the target version to 5.1.0.

Actions #18

Updated by Go MAEDA 10 months ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the patch in r22244. Thank you for your contribution.

Redmine 5.1.0 will have X-Redmine-Issue-Priority header field that indicates the issue priority.

Actions #19

Updated by Mischa The Evil 4 months ago

  • Start date deleted (2009-02-13)
Actions #20

Updated by Go MAEDA 4 months ago

  • Tracker changed from Patch to Feature
  • Resolution set to Fixed
Actions

Also available in: Atom PDF