当我迭代IMAP文件夹的收件箱以查找具有特定主题行和发件人电子邮件地址的邮件时,我得到了一些重复的项目。例如,在Outlook应用程序中,我只能看到3条消息通过过滤器,但是下面的脚本会生成5条消息,其中一条消息被读取3次。我一直在检查,即使主题行和正文文本相同,每个重复元素也有不同的ConversationID。如果我在Outlook面板中看不到它们,那么那些重复的来自哪里?
提前致谢!
Private Sub GetFromFolder(ofldr)
Dim oItem
Dim oSubFldr
Dim sBadEmail
Dim matches
Dim colMail
Dim i
Dim key
Set colMail = CreateObject("Scripting.Dictionary")
i = 1
' Process all mail items in this folder
For Each oItem In ofldr.Items
If TypeName(oItem) = "MailItem" Then
With oItem
If StrComp(.Subject, g_SubjectLine) = 0 And StrComp(.SenderEmailAddress, g_SystemEmailAddress) = 0 Then
'ProcessQuery .Body
colMail.Add i, oItem
i = i + 1
End If
End With
End If
Next
For Each key In colMail.Keys
ProcessQuery colMail.Item(key).Body
Next
set colMail = Nothing
End Sub