E
Ethan Shayne
I am trying to get Outlook 2000 to automatically bcc a specific
address on all outgoing email. I started with the VBA script shown on
the Slipstick web site
(http://www.slipstick.com/dev/code/autobcc.htm), then modified it to
use the Outlook Redemption library to avoid the security prompts.
The result is that it works - sometimes. I haven't been able to find
any particular pattern to when it works and when it doesn't. Some
outgoing messages are bcc'd to the specified address, some aren't.
This is true of new messages I created from the start as well as
replies and forwards.
I am running Outlook 2000 under Windows 2000 (SP 4). I have all the
latest Microsoft Office 2000 patches/updates installed as well. I've
attached the VBA script I'm using below.
Has anyone else run into this problem?
Thanks,
Ethan
-------------------------
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)
Dim strMsg As String
Dim res As Integer
Dim strBcc As String
Dim oSafeItem As Object
Dim oRecip As Object
Set oSafeItem = CreateObject("Redemption.SafeMailItem")
oSafeItem.Item = Item
' #### USER OPTIONS ####
' address for Bcc -- must be SMTP address or resolvable
' to a name in the address book
strBcc = "(e-mail address removed)"
On Error Resume Next
Set oRecip = oSafeItem.Recipients.Add(strBcc)
If oRecip Is Nothing Then
strMsg = "BCC recipient could not be added (" & Err & "). Do
you still want to send the message?"
res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
"Recipient could not be added")
If res = vbNo Then
Cancel = True
End If
End If
' handle case of user canceling Outlook security dialog
If Err = 287 Then
strMsg = "Could not add a Bcc recipient " & _
"because the user said No to the security prompt." & _
" Do you want still to send the message?"
res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
"Security Prompt Cancelled")
If res = vbNo Then
Cancel = True
Else
objRecip.Delete
End If
Err.Clear
Else
oRecip.Type = olBCC
oRecip.Resolve
If Not oRecip.Resolved Then
strMsg = "Could not resolve the Bcc recipient " & "(" &
Err & "). " & _
"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
End If
Set oRecip = Nothing
Set oSafeItem = Nothing
End Sub
address on all outgoing email. I started with the VBA script shown on
the Slipstick web site
(http://www.slipstick.com/dev/code/autobcc.htm), then modified it to
use the Outlook Redemption library to avoid the security prompts.
The result is that it works - sometimes. I haven't been able to find
any particular pattern to when it works and when it doesn't. Some
outgoing messages are bcc'd to the specified address, some aren't.
This is true of new messages I created from the start as well as
replies and forwards.
I am running Outlook 2000 under Windows 2000 (SP 4). I have all the
latest Microsoft Office 2000 patches/updates installed as well. I've
attached the VBA script I'm using below.
Has anyone else run into this problem?
Thanks,
Ethan
-------------------------
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)
Dim strMsg As String
Dim res As Integer
Dim strBcc As String
Dim oSafeItem As Object
Dim oRecip As Object
Set oSafeItem = CreateObject("Redemption.SafeMailItem")
oSafeItem.Item = Item
' #### USER OPTIONS ####
' address for Bcc -- must be SMTP address or resolvable
' to a name in the address book
strBcc = "(e-mail address removed)"
On Error Resume Next
Set oRecip = oSafeItem.Recipients.Add(strBcc)
If oRecip Is Nothing Then
strMsg = "BCC recipient could not be added (" & Err & "). Do
you still want to send the message?"
res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
"Recipient could not be added")
If res = vbNo Then
Cancel = True
End If
End If
' handle case of user canceling Outlook security dialog
If Err = 287 Then
strMsg = "Could not add a Bcc recipient " & _
"because the user said No to the security prompt." & _
" Do you want still to send the message?"
res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
"Security Prompt Cancelled")
If res = vbNo Then
Cancel = True
Else
objRecip.Delete
End If
Err.Clear
Else
oRecip.Type = olBCC
oRecip.Resolve
If Not oRecip.Resolved Then
strMsg = "Could not resolve the Bcc recipient " & "(" &
Err & "). " & _
"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
End If
Set oRecip = Nothing
Set oSafeItem = Nothing
End Sub