PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming RE: Forcing use of Bcc

Reply

RE: Forcing use of Bcc

 
Thread Tools Rate Thread
Old 05-08-2004, 05:51 PM   #1
=?Utf-8?B?RGFuaWVs?=
Guest
 
Posts: n/a
Default RE: Forcing use of Bcc


Thanks Eric, I must admit that I do not know how to perform what you are
suggesting. In my ignorance, the result sounds like it may be backwards in
terms of user performed actions. When a user selects a distibution list, I
want it to automatically be placed into the Bcc field, essentially disabling
the To and CC fields for those recipient types only.

I have full access to the AD console and Exchange2003 management. If you
would be willing to walk me through this I'd be greatful.

"Eric Legault [MVP - Outlook]" wrote:

> You can trap the Send event of an open e-mail, and check the Recipients collection to ensure that the Bcc Recipient objects have a DisplayType property of olDistList. If they don't, display a message and cancel the send.
>
> --
> Eric Legault - B.A, MCP, MCSD, Outlook MVP
> --------------------------------------------------
> {Private e-mails ignored}
> Job: http://www.imaginets.com
> Blog: http://blogs.officezealot.com/legault/
>
>
>
> "Daniel" wrote:
>
> > Is it possible to force specific addresses from Exchange to only be usable via the Bcc field? We intend to ammeliorate spam (email address spoofing) by using our distribution lists only in the Bcc field. But if someone forgets to do this, it becomes worthless.
> >
> > Thanks

  Reply With Quote
Old 05-08-2004, 06:35 PM   #2
=?Utf-8?B?RXJpYyBMZWdhdWx0IFtNVlAgLSBPdXRsb29rXQ==
Guest
 
Posts: n/a
Default RE: Forcing use of Bcc

Do you have any experience programming Outlook? If not, here is a great link to get you started:

Visual Basic and VBA Coding in Microsoft Outlook:
http://www.outlookcode.com/d/vb.htm

Otherwise, I've coded a solution for you to do what you want. Note that there is nothing we can do with the properties of the Distribution Lists themselves to force them to be sent a specific way (To, Cc, Bcc). Nor can we code against these Distribution Lists objects in AD/Exchange.

The solution has to be client-side, running in the context of Outlook. This can be done via VBA macros, or a COM Add-In. The latter is more involved, but below is some code that you can install on every Outlook PC that needs this functionality. This solution will monitor the To: and Cc: fields in a new e-mail message. Whenever the user adds an address to either field, if it is a Distribution List, it will get moved to the Bcc: field.

To configure the solution, open the Visual Basic Editor in Outlook (ALT+F11) and create a new Class - call it "clsForceBCCForDLs". Paste this code into that Class:

Option Explicit
Dim WithEvents objCurrentMailItem As Outlook.MailItem
Dim WithEvents objInspectors As Outlook.Inspectors

Private Sub Class_Initialize()
Set objInspectors = Application.Inspectors
End Sub

Private Sub Class_Terminate()
Set objInspectors = Nothing
Set objCurrentMailItem = Nothing
End Sub

Private Sub objCurrentMailItem_PropertyChange(ByVal Name As String)
If Name = "To" Or Name = "Cc" Then
ChangeDLsToBcc
End If
End Sub

Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
Select Case Inspector.CurrentItem.Class
Case olMail
Set objCurrentMailItem = Inspector.CurrentItem
End Select
End Sub

Sub ChangeDLsToBcc()
On Error Resume Next

Dim objR As Outlook.Recipient
Dim objRs As Outlook.Recipients

Set objRs = objCurrentMailItem.Recipients

For Each objR In objRs
If objR.DisplayType = olDistList Then
If objR.Type = olTo Or objR.Type = olCC Then
objR.Type = olBCC
End If
End If
Next
End Sub

Next, open the ThisOutlookSession module and paste the following code into that:

Option Explicit
Dim myBccChecker As clsForceBCCForDLs

Private Sub Application_Startup()
Set myBccChecker = New clsForceBCCForDLs
End Sub

Private Sub Application_Quit()
Set myBccChecker = Nothing
End Sub

You'll have to restart Outlook for the changes to take effect. See the aforementioned link for full information on managing Outlook VBA projects and macros.

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/



"Daniel" wrote:

> Thanks Eric, I must admit that I do not know how to perform what you are
> suggesting. In my ignorance, the result sounds like it may be backwards in
> terms of user performed actions. When a user selects a distibution list, I
> want it to automatically be placed into the Bcc field, essentially disabling
> the To and CC fields for those recipient types only.
>
> I have full access to the AD console and Exchange2003 management. If you
> would be willing to walk me through this I'd be greatful.
>
> "Eric Legault [MVP - Outlook]" wrote:
>
> > You can trap the Send event of an open e-mail, and check the Recipients collection to ensure that the Bcc Recipient objects have a DisplayType property of olDistList. If they don't, display a message and cancel the send.
> >
> > --
> > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > --------------------------------------------------
> > {Private e-mails ignored}
> > Job: http://www.imaginets.com
> > Blog: http://blogs.officezealot.com/legault/
> >
> >
> >
> > "Daniel" wrote:
> >
> > > Is it possible to force specific addresses from Exchange to only be usable via the Bcc field? We intend to ammeliorate spam (email address spoofing) by using our distribution lists only in the Bcc field. But if someone forgets to do this, it becomes worthless.
> > >
> > > Thanks

  Reply With Quote
Old 05-08-2004, 08:13 PM   #3
=?Utf-8?B?RGFuaWVs?=
Guest
 
Posts: n/a
Default RE: Forcing use of Bcc

The client side will be fine. I gave it a go but it didn't take. I am using
Outlook2003 if that makes a difference. I have in the VBA editor:

Project1(VbaProject.OTM)
Microsoft Office Outlook Objects
ThisOutlookSession
Class Modules
clsForceBCCForDLs

ThisOutlookSession
CODE>>>>>>>>>>
Option Explicit
Dim myBccChecker As clsForceBCCForDLs

Private Sub Application_Startup()
Set myBccChecker = New clsForceBCCForDLs
End Sub

Private Sub Application_Quit()
Set myBccChecker = Nothing
End Sub
>>>>>>>>>>>>>>>>>>>>.


clsForceBCCForDLs (properties Name = clsForceBCCForDLs, Instancing = Private)
CODE>>>>>>>>>>
Option Explicit
Dim myBccChecker As clsForceBCCForDLs

Private Sub Application_Startup()
Set myBccChecker = New clsForceBCCForDLs
End Sub

Private Sub Application_Quit()
Set myBccChecker = Nothing
End Sub
>>>>>>>>>>>>>>>>>>>>.


Thank you very much for taking a stab at it this far.
Daniel

"Eric Legault [MVP - Outlook]" wrote:

> Do you have any experience programming Outlook? If not, here is a great link to get you started:
>
> Visual Basic and VBA Coding in Microsoft Outlook:
> http://www.outlookcode.com/d/vb.htm
>
> Otherwise, I've coded a solution for you to do what you want. Note that there is nothing we can do with the properties of the Distribution Lists themselves to force them to be sent a specific way (To, Cc, Bcc). Nor can we code against these Distribution Lists objects in AD/Exchange.
>
> The solution has to be client-side, running in the context of Outlook. This can be done via VBA macros, or a COM Add-In. The latter is more involved, but below is some code that you can install on every Outlook PC that needs this functionality. This solution will monitor the To: and Cc: fields in a new e-mail message. Whenever the user adds an address to either field, if it is a Distribution List, it will get moved to the Bcc: field.
>
> To configure the solution, open the Visual Basic Editor in Outlook (ALT+F11) and create a new Class - call it "clsForceBCCForDLs". Paste this code into that Class:
>
> Option Explicit
> Dim WithEvents objCurrentMailItem As Outlook.MailItem
> Dim WithEvents objInspectors As Outlook.Inspectors
>
> Private Sub Class_Initialize()
> Set objInspectors = Application.Inspectors
> End Sub
>
> Private Sub Class_Terminate()
> Set objInspectors = Nothing
> Set objCurrentMailItem = Nothing
> End Sub
>
> Private Sub objCurrentMailItem_PropertyChange(ByVal Name As String)
> If Name = "To" Or Name = "Cc" Then
> ChangeDLsToBcc
> End If
> End Sub
>
> Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
> Select Case Inspector.CurrentItem.Class
> Case olMail
> Set objCurrentMailItem = Inspector.CurrentItem
> End Select
> End Sub
>
> Sub ChangeDLsToBcc()
> On Error Resume Next
>
> Dim objR As Outlook.Recipient
> Dim objRs As Outlook.Recipients
>
> Set objRs = objCurrentMailItem.Recipients
>
> For Each objR In objRs
> If objR.DisplayType = olDistList Then
> If objR.Type = olTo Or objR.Type = olCC Then
> objR.Type = olBCC
> End If
> End If
> Next
> End Sub
>
> Next, open the ThisOutlookSession module and paste the following code into that:
>
> Option Explicit
> Dim myBccChecker As clsForceBCCForDLs
>
> Private Sub Application_Startup()
> Set myBccChecker = New clsForceBCCForDLs
> End Sub
>
> Private Sub Application_Quit()
> Set myBccChecker = Nothing
> End Sub
>
> You'll have to restart Outlook for the changes to take effect. See the aforementioned link for full information on managing Outlook VBA projects and macros.
>
> --
> Eric Legault - B.A, MCP, MCSD, Outlook MVP
> --------------------------------------------------
> {Private e-mails ignored}
> Job: http://www.imaginets.com
> Blog: http://blogs.officezealot.com/legault/
>
>
>
> "Daniel" wrote:
>
> > Thanks Eric, I must admit that I do not know how to perform what you are
> > suggesting. In my ignorance, the result sounds like it may be backwards in
> > terms of user performed actions. When a user selects a distibution list, I
> > want it to automatically be placed into the Bcc field, essentially disabling
> > the To and CC fields for those recipient types only.
> >
> > I have full access to the AD console and Exchange2003 management. If you
> > would be willing to walk me through this I'd be greatful.
> >
> > "Eric Legault [MVP - Outlook]" wrote:
> >
> > > You can trap the Send event of an open e-mail, and check the Recipients collection to ensure that the Bcc Recipient objects have a DisplayType property of olDistList. If they don't, display a message and cancel the send.
> > >
> > > --
> > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > --------------------------------------------------
> > > {Private e-mails ignored}
> > > Job: http://www.imaginets.com
> > > Blog: http://blogs.officezealot.com/legault/
> > >
> > >
> > >
> > > "Daniel" wrote:
> > >
> > > > Is it possible to force specific addresses from Exchange to only be usable via the Bcc field? We intend to ammeliorate spam (email address spoofing) by using our distribution lists only in the Bcc field. But if someone forgets to do this, it becomes worthless.
> > > >
> > > > Thanks

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off