automatic BCC using Redemption and VBA - only works sometimes

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
 
S

Sue Mosher [MVP-Outlook]

You might want to put a breakpoint in and step through the code to get an
idea of where it's having a problem. Even consider taking out the On Error
Resume Next, in case an error is creeping in that you don't know about.
 
E

Ethan Shayne

Thanks for the advice.

Unfortunately - I tried setting a breakpoint, and it stepped through
the process exactly as I would expect, no errors or anything strange.
But sometimes no bcc in the final message, either. I also tried taking
out the "On Error Resume Next," with the same result - no errors, but
(sometimes) no bcc.

A few additional pieces of information:

- It seems that replies and forwards are more prone to this problem
than newly created messages - though even this rule is not 100%
followed all the time, in either direction.

- When I have Outlook set to not send messages immediately, I can open
the messages after they have been "sent" (or queued to be sent) in the
Outbox and I can see there that some do not have the bcc value set,
while others do. In other words, it is not a problem with my SMTP
server or anything like that - it is definitely that Outlook is simply
not assigning the bcc value.

- I am using Outlook in Internet Only mode, if that helps.

Thanks,
Ethan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top