Private Sub m_oApp_ItemSend(ByVal Item As Object, Cancel
As Boolean)
Dim oMapiRecipient As Outlook.Recipient
Dim oMapiItm As Outlook.MailItem
Dim sModName As String
Dim sMailbox As String
On Error GoTo errHandler
Set oMapiItm = Item
sModName = App.EXEName & ":" & CLASS_NAME
& ":ItemSendEvent"
WriteEvent sModName, "ItemSend Event Starts", LOG_INFO
' Only outgoing emails need to be copied to Claimbox
If Not oMapiItm.UserProperties("Direction") Is
Nothing And _
oMapiItm.UserProperties("Direction") = "O" Then
WriteEvent sModName, "Process an Outgoing
Message", LOG_INFO
If sMailbox <> "" Then
WriteEvent sModName, "Add Claimbox as BCC",
LOG_INFO
Set oMapiRecipient = oMapiItm.Recipients.Add
(oMapiItm.UserProperties("Claimbox"))
With oMapiRecipient
.Resolve
.Type = olBCC
End With
Else
' Cancel the process to keep the message
Cancel = True
WriteEvent sModName, "Missing Claimbox",
LOG_INFO
End If
End If
cleanUp:
Set oMapiRecipient = Nothing
Set oMapiItm = Nothing
Exit Sub
errHandler:
On Error Resume Next
WriteEvent sModName, "[" & Err.Number & "] " &
Err.Description, LOG_ERROR
GoTo cleanUp
End Sub