E
Ethan Shayne
I am trying to adopt the automatic BCC code shown on the Slipstick web
site (http://www.slipstick.com/dev/code/autobcc.htm) to work with the
Outlook Redemption library, as the Slipstick page suggests to get
around the security prompts.
Unfortunately, I don't seem to be able to get this to work.
Specifically, I tried substituting in the Redemption SafeMailItem
object (see VBA code below), but what seems to be happening is that
the Recipients.Add() method is returning Nothing (instead of the new
Recipient). Err is set to 13.
Has anyone successfully modified the Slipstick automatic BCC code to
work with Redemption? And if so, could you please post your script?
Or, failing that, can anyone tell me what I'm doing wrong?
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 Recipient
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
site (http://www.slipstick.com/dev/code/autobcc.htm) to work with the
Outlook Redemption library, as the Slipstick page suggests to get
around the security prompts.
Unfortunately, I don't seem to be able to get this to work.
Specifically, I tried substituting in the Redemption SafeMailItem
object (see VBA code below), but what seems to be happening is that
the Recipients.Add() method is returning Nothing (instead of the new
Recipient). Err is set to 13.
Has anyone successfully modified the Slipstick automatic BCC code to
work with Redemption? And if so, could you please post your script?
Or, failing that, can anyone tell me what I'm doing wrong?
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 Recipient
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