Thursday, 19 March 2009

automatically BCC in Outlook 2007

Have you ever wanted to automatically bcc all your outbound mail to a specific email address? I wanted to send a copy of ALL sent mail from Outlook at work to my Gmail address. You could try to do this via Outlook's Rules and Alerts, but there's no option to bcc...only cc. I'd prefer that all my work contacts not know my personal Gmail address, and it's not very professional. I also don't want to manually enter my Gmail address in the bcc field of every outgoing message... the solution? Visual Basic Scripting.

The steps (MS Outlook 2007):
  1. Open MS Outlook 2007
  2. Under the Tools menu, select Macro > Visual Basic Editor (or Alt+F11)
  3. In the left menu bar, expand Project1, Microsoft Outlook Session, and open ThisOutlookSession
  4. Enter copy & paste this code, making sure to substitute youremailaddress@domain.com with your real email address:
Private Sub Application_ItemSend(ByVal Item As Object, _
Cancel As Boolean)
Dim objRecip As Recipient
Dim strMsg As String
Dim res As Integer
Dim strBcc As String
On Error Resume Next

' #### USER OPTIONS ####
' address for Bcc -- must be SMTP address or resolvable
' to a name in the address book
strBcc = "youremailaddress@domain.com"

Set objRecip = Item.Recipients.Add(strBcc)
objRecip.Type = olBCC
If Not objRecip.Resolve Then
strMsg = "Could not resolve the Bcc recipient. " & _
"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

Set objRecip = Nothing
End Sub

Save the session, close the Visual Basic Editor, restart Outlook, and you're good to go! (make sure that you've allowed Outlook to run macros) You can verify that your emails are being cc'd by (1) checking your alternate email address or (2) looking at the bcc field of one of your messages in the Sent Items folder.

29 comments:

  1. this iss super i had same problem with rules and alerts

    ReplyDelete
  2. Hi,

    This is very great!

    How can we adjust it to BCC only if the "subject includes a spcific string?

    Many thanks,
    Mina

    ReplyDelete
  3. how do i see the BCC field in my sent emails?

    ReplyDelete
  4. have followed above rules and copied code but doesn't seem to work. what is bit is green re ' #### USER OPTIONS ####' address for Bcc -- must be SMTP address or resolvable' to a name in the address book - Thanks

    ReplyDelete
  5. @Anonymous(1)- Open your Sent Items folder and then open a message which was bcc'd. In the header/info portion of the email (top left) you will see the bcc address under the "Bcc:" field. This should appear below the "To:" field and immediately above the Subject.

    ReplyDelete
  6. @Anonymous(2) - The green portion of the code is a comment. It doesn't affect the rest of the code, but it reminds users that the email address you enter (to replace the red text) must either be a normal SMTP resolvable email address or a name in your Address Book.

    ReplyDelete
  7. Dear Andrew,
    It's a great script and work well.
    However, I wonder if we would like to multiple
    BCC: email address.
    What can I do or edit the code ?

    Thank a million..

    Nont

    ReplyDelete
  8. This is awesome. One question: Can you tie it to a specific account? I have several accounts set up in my outlook, and I only want the auto bcc for two of them. Any help would be greatly appreciated!

    ReplyDelete
  9. @EricaB hmm not sure how to tie it to a single account. I've just played with global Outlook rules. You could try adding 'If Item.SenderEmailAddress = "YOUR@EMAIL.COM"' below line 'objRecip.Type = olBCC' and another 'End If' below the current two. May/may not work...

    ReplyDelete
  10. I've used this to Bcc our new CRM system and it works perfectly. Thanks you've just saved me a $100

    ReplyDelete
  11. If you want to send to two forwarding addresses, can this be done?

    ReplyDelete
  12. @Anon - Hmm, I'm not sure. Try substituting "youremailaddress@domain.com" with "address1@domain.com;address2@domain.com" Unfortunately I no longer use Outlook and cannot test this out.

    ReplyDelete
  13. Andrew,

    Thank you, thank you, thank you for this wonderful macro!

    ReplyDelete
  14. Great..Thanks

    For the last few years have been doing this manually and was a pain.

    never made a macro. so this was perfect and it works!

    Cheers

    ReplyDelete
  15. It does not work with my Outlook 2007 SP2. :(

    ReplyDelete
  16. @ertpresso - Why not/what happens?

    ReplyDelete
  17. Doesn't work on my Outlook 2007 either. The mail sends but when I check the Sent Items there is no Bcc in the mail item and it does not come through to the email address I specified, (which is in my address book). If it matters I run a 32 bit version of Win 7.

    ReplyDelete
  18. I want Hide BCC name when i open sent item mail its showing me. I have to take it confidentially. please help me,
    Thank in Advance

    ReplyDelete
  19. This comment has been removed by the author.

    ReplyDelete
  20. Hi,

    I've noticed this script does not work when I am replying to or forwarding a message that has been filed to a folder.

    Thought you would want to know. I'm going to try to figure it out.

    Thanks.

    Rich

    ReplyDelete
  21. Thank you very much for sharing this, it helps me a lot !!!

    ReplyDelete
  22. Thanks! This is just what I needed.

    ReplyDelete
  23. Thank you!! It is very helpful..

    ReplyDelete
  24. thanks

    it is working :)

    ReplyDelete
  25. I signed in just to say thank you for this script.
    Thank you very much :)

    ReplyDelete
  26. Hello Andrew,

    It's very helpful.

    Thank you very much!

    Julius

    ReplyDelete
  27. It's working properlly.

    Thank you very much!

    ReplyDelete
  28. This has worked for decades... since two weeks ago it's stopped working. I'm not sure why... anyone else with the same issue?

    Thanks

    ReplyDelete

Enter your comment here