在 Outlook 2010 中线程化 Jira 通知电子邮件

在 Outlook 2010 中线程化 Jira 通知电子邮件

当我在 Outlook 2010 中收到 Jira 4.2 通知电子邮件时,它们不会被线程化。当然,默认情况下,Jira 会发送带有如下主题的电子邮件:[JIRA] Created: (LTST-4) improve documentation[JIRA] Assigned: (LTST-4) improve documentation。我在网上看到 Outlook 2010 仅使用主题字段进行线程化,因此使用上述主题将强制这些电子邮件不被线程化,事实确实如此。请注意,例如,Gmail 也不会将这些相同的电子邮件线程化(但 Apple iPhone 4 邮件应用程序实际上会!)。

因此,我调整了 Jira 设置,从主题中删除了“操作已执行”动词,现在所有电子邮件主题都像这样:[JIRA] (LTST-4) improve documentation。Gmail 很乐意将它们串联起来。但 Outlook 2010 仍然不行!

在 Jira 配置或 Outlook 配置方面,我能做些什么来强制 Outlook 2010 对 Jira 通知电子邮件进行线程化?

谢谢,基里尔

答案1

以下 VBA 宏只会在您的收件箱中为每个 Jira 问题保留 1 条消息。它还会删除有关已解决/已关闭问题的消息,因为我不需要查看这些消息

' Tools>References: Microsoft VBScript Regular Expressions 5.5, Microsoft Scripting Runtime

Sub RemoveDuplicateJiraKeys()
    Dim i As Object
    Dim re As New RegExp
    Dim m As MatchCollection
    Dim d As New Dictionary
    Dim act As String ' Commented, Resolved, Updated...
    Dim key As String ' e.g. RS-123

    re.Pattern = "\[JIRA\] (.*?): \((.*?)\)"
    For Each i In Session.GetDefaultFolder(olFolderInbox).Items
      ' luckily the items come in chronological order
      Set m = re.Execute(i.Subject)
      If m.Count >= 1 Then
        act = m(0).SubMatches(0)
        key = m(0).SubMatches(1)
        If d.Exists(key) Then d(key).Delete: d.Remove (key) ' same Jira key but older
        If act = "Resolved" Or act = "Closed" Then i.Delete Else d.Add key, i
      End If
    Next i
End Sub

答案2

Outlook 2010 仅按主题排列对话(线程)。从 JIRA 中的电子邮件主题中删除“操作”应该会将它们放在 Outlook 收件箱中。听起来您可能需要检查 Outlook 设置。更多信息可用这里

答案3

我使用了其他答案 发布,以及本文编写我自己的宏,使用赎回图书馆合并对话。

这将扫描当前文件夹,挑选出任何 jira 电子邮件,从主题中提取问题密钥。如果之前没有见过该密钥,它会根据问题密钥将对话索引保存在集合中,如果之前见过,它使用保存的对话索引更新电子邮件。

Dim ConversationIndexes As New Collection

Sub GroupJira()
    Dim MapiNamespace As Object
    Dim RdoSession As Object

    Dim Item As Object
    Dim RdoItem As Object

    Dim ConversationKey As String
    Dim ConversationIndex As String

    ' Get all the required handles
    Set MapiNamespace = Outlook.GetNamespace("MAPI")
    MapiNamespace.Logon
    Set RdoSession = CreateObject("Redemption.RDOSession")
    RdoSession.MAPIOBJECT = MapiNamespace.MAPIOBJECT

    'Setup some subject patterns to extract the issue key
    Dim Matches As MatchCollection
    Dim UpdateSubjectPattern As New RegExp
    UpdateSubjectPattern.Pattern = "\[JIRA\] \(([A-Z]+-[0-9]+)\) .*"
    Dim MentionedSubjectPattern As New RegExp
    MentionedSubjectPattern.Pattern = "\[JIRA\] .* mentioned you on ([A-Z]+-[0-9]+) \(JIRA\)"

    For Each Item In Outlook.ActiveExplorer.CurrentFolder.Items
        If TypeOf Item Is MailItem Then
            If Left(Item.Subject, 7) = "[JIRA] " Then
                ' Get a key for this conversation, opic for now
                ConversationKey = Item.ConversationTopic
            Set Matches = UpdateSubjectPattern.Execute(Item.Subject)
            If Matches.Count >= 1 Then ConversationKey = Matches(0).SubMatches(0)
            Set Matches = MentionedSubjectPattern.Execute(Item.Subject)
            If Matches.Count >= 1 Then ConversationKey = Matches(0).SubMatches(0)

                ' Get any saved indexes
                ConversationIndex = ""
                On Error Resume Next
                ConversationIndex = ConversationIndexes.Item(ConversationKey)
                On Error GoTo 0

                If ConversationIndex = "" Then
                    ' Save this index if not seen yet
                    ConversationIndexes.Add Item.ConversationIndex, ConversationKey
                ElseIf Item.ConversationIndex <> ConversationIndex Then
                    ' Set the item's index if it has
                    Set RdoItem = RdoSession.GetMessageFromID(Item.EntryID, Item.Parent.StoreID)
                    RdoItem.ConversationIndex = ConversationIndex
                    RdoItem.Save
                End If
            End If
        End If
    Next Item
End Sub

这需要以下库:

  • 赎回图书馆对于完整的 RDO 访问,需要设置对话索引(这不需要提升来注册)
  • Microsoft VBScript Regular Expressions 5.5对从邮件主题中提取问题密钥的库的引用。

哦,您还需要调整宏安全设置才能运行它。

相关内容