Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 323
  • Last Modified:

Automatic CC On Outgoing

Hey there.

One of my attorneys had asked if it was possible to automatically have someone CC'd on an email if it goes to three specified people. I told him the only way I can think of is to make a distribution list or group and put all four people in but then the 4th person wouldn't be CC'd like he would like. Is this possible? Maybe though a rule or something? Thanks for any help you can offer!
0
macbrando
Asked:
macbrando
  • 3
  • 2
1 Solution
 
Patrick MatthewsCommented:
Hello macbrando,

You could try this.

1) Go to VB Editor

2) In the ThisOutlookSession module, paste this code:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

    If Item.Class = olMail Then
        Dim recip As Recipient
        For Each recip In Item.Recipients
            Select Case LCase(recip.Address)
                Case "person1@fakedomain.com", "person2@fakedomain.com", "person3@fakedomain.com"
                    Item.Recipients.Add("someone.else@anotherfakedomain.com").Type = olCC
                    Exit For
            End Select
        Next
    End If

End Sub

Regards,

Patrick
0
 
macbrandoAuthor Commented:
This works great but it doesn't send the actual message. It's adds the CC but it will put it in the Outbox and never send it. Is there something like "Item.Send" that can be added to the end of this?
0
 
Patrick MatthewsCommented:
macbrando,

There's no need.  It is an "event" sub, the event being the user clicking the Send button.  The
code checks the outgoing item, and if it meets the criteria the CC is added.

Were you trying to launch the sub yourself?

Regards,

Patrick
0
 
macbrandoAuthor Commented:
No. I put the script where you told me to put it in then composed a new message. Typed the three email addresses that I set it to, typed a subject and body and clicked send. I then saw that the message never made it into my Sent Mail so I checked my outbox and it was there. It never actually got sent even though the CC was there. We use an Exchange server so it wouldn't have been delayed waiting for the next send/recieve cycle.
0
 
Patrick MatthewsCommented:
macbrando,

That's odd.  I did test the code and it worked without incident...

Regards,

Patrick
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now