如何删除 SENT 文件夹中的自动转发电子邮件 Outlook 2010 Exchange
How to delete autoforwarded email in SENT folder Outlook 2010 Exchange
新手 post Outlook VBA。中级 Excel VBA 编码员。
我有一个 VBA 例程,可以将所有收到的电子邮件自动转发到 Gmail 帐户。这不是我的全部代码(从博客 post 修改)但它有效。我需要保留所有帐户中收到的所有电子邮件的副本,以便将它们合并为一个主要电子邮件。在 Outlook 2010 Exchange 帐户中,所有转发的邮件都会作为副本保存在 SENT 文件夹中。
是否可以删除 SENT 文件夹中自动转发的副本,而不删除所有 SENT 电子邮件?我需要保留我实际回复的电子邮件。
我在收件箱中使用对话模式存储回复的电子邮件不会有问题。但就目前而言,当我切换收件箱的对话模式时,由于 SENT 文件夹中的密件抄送副本,所有内容都是重复的。
在此先感谢您的帮助。
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objRecip As Recipient
Dim strMsg As String
Dim res As Integer
Dim strBcc As String
On Error Resume Next
' #### USER OPTIONS ####
' address for Bcc -- must be SMTP address or resolvable
' to a name in the address book
strBcc = "bcc.hwb@gmail.com"
Set objRecip = Item.Recipients.Add(strBcc)
objRecip.Type = olBCC
If Not objRecip.Resolve Then
strMsg = "Could not resolve the Bcc recipient. " & _
"Do you want still to send the message?"
res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
"Could Not Resolve Bcc Recipient")
If res = vbNo Then
Cancel = True
End If
End If
Set objRecip = Nothing
End Sub
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim varEntryIDs
Dim objItem
Dim myItem As MailItem
Dim i As Integer
varEntryIDs = Split(EntryIDCollection, ",")
For i = 0 To UBound(varEntryIDs)
Set objItem = Application.Session.GetItemFromID(varEntryIDs(i))
'MsgBox (varEntryIDs(i))
Set myItem = objItem.Forward
myItem.Recipients.Add "bcc.hwb@gmail.com"
myItem.Send
'myItem.Delete
Set myItem = Nothing
Next
End Sub
见MailItem.DeleteAfterSubmit Property (Outlook)
myItem.DeleteAfterSubmit = True
新手 post Outlook VBA。中级 Excel VBA 编码员。
我有一个 VBA 例程,可以将所有收到的电子邮件自动转发到 Gmail 帐户。这不是我的全部代码(从博客 post 修改)但它有效。我需要保留所有帐户中收到的所有电子邮件的副本,以便将它们合并为一个主要电子邮件。在 Outlook 2010 Exchange 帐户中,所有转发的邮件都会作为副本保存在 SENT 文件夹中。
是否可以删除 SENT 文件夹中自动转发的副本,而不删除所有 SENT 电子邮件?我需要保留我实际回复的电子邮件。
我在收件箱中使用对话模式存储回复的电子邮件不会有问题。但就目前而言,当我切换收件箱的对话模式时,由于 SENT 文件夹中的密件抄送副本,所有内容都是重复的。
在此先感谢您的帮助。
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objRecip As Recipient
Dim strMsg As String
Dim res As Integer
Dim strBcc As String
On Error Resume Next
' #### USER OPTIONS ####
' address for Bcc -- must be SMTP address or resolvable
' to a name in the address book
strBcc = "bcc.hwb@gmail.com"
Set objRecip = Item.Recipients.Add(strBcc)
objRecip.Type = olBCC
If Not objRecip.Resolve Then
strMsg = "Could not resolve the Bcc recipient. " & _
"Do you want still to send the message?"
res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
"Could Not Resolve Bcc Recipient")
If res = vbNo Then
Cancel = True
End If
End If
Set objRecip = Nothing
End Sub
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim varEntryIDs
Dim objItem
Dim myItem As MailItem
Dim i As Integer
varEntryIDs = Split(EntryIDCollection, ",")
For i = 0 To UBound(varEntryIDs)
Set objItem = Application.Session.GetItemFromID(varEntryIDs(i))
'MsgBox (varEntryIDs(i))
Set myItem = objItem.Forward
myItem.Recipients.Add "bcc.hwb@gmail.com"
myItem.Send
'myItem.Delete
Set myItem = Nothing
Next
End Sub
见MailItem.DeleteAfterSubmit Property (Outlook)
myItem.DeleteAfterSubmit = True