A step-by-step screenshot tutorial for automatically BCCing an email address for all outgoing Outlook messages.From Outlook 2007 to Outlook 2010, Microsoft removed the BCC field. We’ll show you how to add the BCC field back in.To auto BCC in Outlook, we’ll need to show the developer tab and add a script.See the comments for how to set up an automatic BCC for messages sent only from a particular email address (for multiple Outlook accounts—thanks, Nathan!)
Perhaps it was due to one too many passive-aggressive intra-office stealth BCCs (Blind Carbon Copy.) But seriously, for some reason, Microsoft decided to roll back access to BCCs in Office 2010. For one, the new message dialog doesn’t even have a BCC field. But you also can’t set up Outlook 2010 rules to automatically BCC someone (although you can set up a rule to automatically CC a message.) For my purposes, this is kind of a pain. I am a Gmail/Outlook hybrid user (I have about three different email addresses, each for a different purpose) and I like to keep all of my messages archived in my main Gmail account for easy reference. So, what I wanted was a way to forward all of my sent messages to my Gmail account (I already have all incoming messages forwarded there by a server-side rule.) Easier said than done but I think I’ve figured out the easiest way. It turns out that there are three things to be done to unlock the full potential of BCC in Outlook 2010: It’s not as complicated as it seems. But let’s move through these three from easiest to hardest. (Note: You can also buy third-party Add-Ins for Outlook 2010 that do this—but I’d recommend this method. It’s free.)
Show the BCC Field in New Emails in Outlook 2010
Step 1
Launch Outlook 2010.
Step 2
Click the New Email button. In the message composition window, click the Options tab.
Step 3
Click the BCC button. This action reveals the BCC field. Henceforth, you shall have access to the BCC field in all future Outlook 2010 emails. If you get tired of the extra space it takes up, just click it again to be rid of it.
Now, you can use the BCC field for one-offs. But what if you wanted to automatically BCC yourself (or someone else) on every outgoing message? To do this, follow the steps below.
Display the Developer Ribbon
I’m basing this how-to on a great bit of custom Visual Basic code written by Michael Kizer. Michael wrote this VBA snippet for Outlook 2007, but it works for Outlook 2010. The only problem: it’s a bit tough to find Visual Basic Editor in Outlook 2010. It’s hiding in the Developer ribbon, which, by default, is hidden from view. Here’s how to enable it:
Step 1
Launch Outlook 2010.
Step 2
Click the File tab and choose Options.
Step 3
Click Customize Ribbon on the left-hand panel. Now, in the list on the far right, make sure Developer is checked. Click OK.
Step 4
The Developer tab will now be revealed in your Outlook 2010 ribbon.
Automatically BCC Outgoing Messages in Outlook 2010
Now, it’s time to add the code that Mr. Kizer put together.
Step 1
Go to the Developer tab and click Visual Basic.
Step 2
On the left, expand Project1 (VbaProject.OTM to reveal Microsoft Outlook Objects. Expand Microsoft Outlook Objects and then double-click ThisOutlookSession.
Step 3
In the code editor window, choose Application from the drop-down menu in the top-left.
Step 4
In the top-left drop-down menu, choose ItemSend.
Step 5
Position your cursor after “Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)” and before “End Sub.” Now, copy and paste the following between those two lines.
Step 6
Look for the line that reads: strBcc=”SomeEmailAddress@domain.com” and replace it with the email address you’d like to BCC for SomeEmailAddress@domain.com. For example, swap it out for mysecondaryemail@gmail.com or igbrother@supervisor.com.
Step 7
Don’t forget to save the changes. Close the Visual Basic Editor and return to Outlook.
Now, when you send messages from Outlook 2010, they’ll be automatically BCC’d to the recipient you chose in the Visual Basic editor. You don’t have to type their name in the BCC field, nor will you even see it entered into the BCC field since the Visual Basic script kicks in after you hit send. (A handy tip for any cyberspies.)
And there you have it.
Filtering BCC’d Gmail Messages
One last thing to note: if you are using this to build a Gmail archive, I recommend using a customized Gmail address with something like +bcc appended to it. However, since the address won’t show up in the to: field, you can’t filter it out like normal. So, instead, you’ll have to use the “deliveredto:” string in Gmail. For example, I’d use “deliveredto: username+bcc@gmail.com” and then set up a rule that automatically archives these messages and marks them as read.
A Note About Macro Security
Note: This section may help those who find that the macro stops working the next day or after a system restart. To get this to work, you may need to alter your macro security settings. Either way, you’ll probably get a nagging message like this when Outlook 2010 launches:
As you can see, that just refers to the script that you put into ThisOutlookSession—it doesn’t mean you have a virus. You can click Enable Macros to proceed with your Auto BCC script intact. If you want to skip this step, you can change your Macro Security settings by going to the Developer tab and clicking Macro Security.
Under “Macro Settings,” you’ll have a few different options:
For a nag-free existence, choose “Enable all macros,” though this is, of course, potentially dangerous. The real solution here is to get your macro digitally signed—but that’s a bit of an involved process, which I’ll go over in another post (How to Create a Self-Signed Digital Certificate in Microsoft Office 2010). Stay tuned! Advise how did u do that?? I followed the very same procedures but it did not work I love you. This is great sharing! Thanks Gmail allows me to have only one gmail account. and you can not direct the incoming emails from “username+bcc@gmail.com” to “username@gmail.com”. What I have done is; I bcc the emails to my original gmail addresse and made the Filter in gmail asd described above and everything worked just FINE no comment?? do you get an error message? maybe you dropped a quote when swapping out your addy for the BCC field? in my case … I want to have the BCC Code work for all emails (new & reply/forward/etc) of my personal account in outlook.. but NOT.. repeat NOT for any of the emails that are to/from my corporate email account! Doing so would potentially violate terms & conditions of client information. AND it would be MUCH better if the CODE would actively put the email address in the BCC so that the user could see the BCC address appear, and selectively choose to remove it. its a function I never liked of other “always BCC” features in outlook and other programs.. and probably one of the reasons other “office” users hated it…. since someone would blindly set it up by accident.. 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 If Item.SendUsingAccount = “ACCOUNT NAME” Then strBcc = “BCC EMAIL ADDRESS GOES HERE” End If Set objRecip = Item.Recipients.Add(strBcc) objRecip.Type = olBCC If Not objRecip.Resolve Then If res = vbNo Then Cancel = True End If End If Set objRecip = Nothing End Sub Please note that the “ACCOUNT NAME” above is the name of the account when you created it can can be found by opening the email account settings, clicking ‘more settings’ then the account name will be under the general tab. Good luck! Any chance to change the variable Item.SendUsingAccount so that not the ACCOUNT NAME but the ACCOUNT MAIL ADDRESS can be used? BR Rudy Just a small additonal tip: even though the title in outlook read “Inbox – EmailAddressWithCaps@something.com – Outlook”, the name of the account was in all lowercase for me The lack of the auto bcc feature in Outlook was stopping me from using it for email. Now I can finally ditch Thunderbird. Many thanks again! Many thanks Any help would be appreciated. Thanks! The rest works great by the way… once I disabled the macros. As an added twist, I have the Outlook option “when replying to a message that is not in the Inbox, save the reply in the same folder”. I use personal folders which help me to keep organized, but it also seems to stymie the macro – no auto self bcc when I forward or reply all to a messages from a personal folder. Any help would be appreciated!! ‘message being sent exceeds the message size estbablihsed for this user’ anyone else having this problem? Thanks, RomanSC1 Are you a first time reader on the site? but you’re exit and login in outlook thanks! I’m glad that I find this article. (I’m a first time reader) I have a question: I have a view emailaccounts, but I don’t need for each of them a BCC. Please, can you tell me, how I can make a BCC for a one or two emailaccounts? thanks! unfortunately it does not work for me anymore. It works exactly the length of one PC switch on. Once I switch off my PC it is gone. Reinstall it’s there. Turn off PC and Turn on again = Gone There’s another program out there but you have to pay and it works perfectly if you have an Outlook address. If you have gmail in Outlook it does not. My solution right now: Whenever I open an email BCC is on as well. I punch in the address(es), think for a second “do I need a copy?”, put in my email address or leave it blank. It works ……….. But i need something little diferent. I need that emails are sent to the BCC: address ONLY if they are going FROM unique email address. Thing is that colegues are using mail enabled public folders (example: support@domain.com), and they are also sending from address from public folder. Now they want to have all outgoing mails in one folder. So i made let’s say Outbox public folder and gave it another email (support_out@domain.com). So what i need that only when i send email FROM support@domain.com that email is BCCed to support_out@domain.com. I have tryed something like: strBcc = “support_out@domain.com” Set objSend = Item.SenderName If objSend = “support@domain.com” Then Set objRecip = Item.Recipients.Add(strBcc) objRecip.Type = olBCC End If Set objRecip = Nothing Set objSend = Nothing NOT working tho :) FYI if i run this without that IF that i added, emails are BCCed to support_out@domain.com just fine. Now i need to do the same only if FROM is support@domain.com THX for any help! 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 = “SomeEmailAddress@domain.com” If Item.SentOnBehalfOfName = “support@domain.com” Then 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 End If Set objRecip = Nothing Here is what I’ve done: 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 = “info@divorcesmart101.co.za” If Item.SentOnBehalfOfName = “christel@divorcesmart101.co.za” Then 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 The error I get is: Compile erro: Expected: Then or GoTo What Im trying to accomplish is when Christel@divorcesmart101.co.za sends email, info@divorcesmart101.co.za must be bcc Hope you can assist Awesome stuff, thanks again. Helped out with a long-standing client. Thanks for your details about adding BCC only when sent from a certain address. It didn’t work for me but, when I changed the line If Item.SentOnBehalfOfName = “support@domain.com” Then to the following line suggested by Rajinder If Item.SendUsingAccount.SmtpAddress = ” SomeEmailAddress@domain.com ” Then Then it worked for me and achieved the result I was looking for. Regards Ron YOU MUST ACTIVATE MACROS OPTION, ON SECURITY SETTINGS!!!! Otherwise: it doesn´t work. Tks To make it work I had to replace objRecip.Type = olBCC by objRecip.Type = Outlook.OlMailRecipientType.olBCC It worked perfectly after this! first of all thanks a lot for the solution for BCC. I was missing this feature for years!!! However I have problems running this feature when activating “outlook social network connector” in the registry: runosc=1 After activating the BCC function is not working anymore. Any idea? Thanks Best regards, Enzio however it is only working on new messages. How can i make it work when i reply or forward messages? thanks Paul Click on Start > All Programs > Microsoft Office > Microsoft Office 2010 Tools > Digital Certificate for VBA Projects Add a certificate name and click on OK.Click OK again when the certificate is created. In Outlook, press Alt-F11. Click on Tools > Digital Signature. Choose the certificate and then click on OK. Note: You may need to install the certificate into the Trusted Root Certification Authorities (which is what I had to do). Save the project, then close VB. Close Outlook and then reopen. Accept any macro warnings that appear the next time that Outlook opens. This is great but how do BCC multiple email addresses? Thanks strBcc = “SomeEmailAddress@domain.com;AnotherEmailAddress@domain.com” 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 Dim objMsg As Outlook.MailItem On Error Resume Next ‘ #### USER OPTIONS #### ‘Select one of the below Options, remove the comment marks (‘) in front of the line ‘Add text to the subject line when sending email Set objMsg = Outlook.ActiveInspector.CurrentItem ‘objMsg.Subject = “Test” ‘objMsg.Subject = “Prepended text here – ” & objMsg.Subject ‘objMsg.Subject = objMsg.Subject & ” – Appended text here” ‘ Address for Bcc — must be SMTP address or resolvable ‘ Automatically selects the bcc address from the set “from” setting or ‘ to a select email address, your choose strBcc = Item.SendUsingAccount ‘strBcc = “SomeEmailAddress@domain.com” ‘ Option 1: Select if you wish to auto bcc from a select account in outlook automatically ‘If Item.SendUsingAccount.SmtpAddress = ” SomeEmailAddress@domain.com ” Then ‘ Option 2: Select through notification meesage before sending the email if you wish to bcc the email res = MsgBox(“Would you like to receive a copy of this message (Bcc)?”, vbYesNo + vbDefaultButton1, _ “BCC Message”) If res = vbNo Then Cancel = False Else ‘ Option 3: Select if you wish to sent on behalf: ‘ If Item.SentOnBehalfOfName = ” SomeEmailAddress@domain.com ” Then Set objRecip = Item.Recipients.Add(strBcc) ‘ objRecip.Type = olBCC objRecip.Type = Outlook.OlMailRecipientType.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 End If Set objRecip = Nothing End Sub If you have problems with it not working, then do the following: • In outlook clicked on Tools/Macros/Security changed the level to Warning for all macros, ok • Again pressed Alt F11, clicked on Tools/Digital Signature click on Choose … u will see the Digital Signature u saved and select and press ok. Restarted Oulook Upon restart it will ask to trust all the macros from press yes. And it’s done Cheers Thanks for the input. But i want to choose from a list of email ids to BCC when i send out a mail. Is it possible? Thanks! Thanks for your details about adding BCC only when sent from a certain address. This helped me to achieve the result I was looking for. Regards Ron I tried a few different VB codes to BCC myself and it actually worked for a day – I LOVED it. But then it STOPPED working. I am using Outlook 2007. Here is what I originally used: 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 ‘ Enter the address for Bcc ‘ It must be SMTP address or ‘ resolvable to a name in the address book strBcc = “jennifer_hill@jackmorton.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 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 ———————————————— Here is what I just tried (not working either): 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 = “jennifer_hill@jackmorton.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 ——————————– Please help! Would love to use this! File — Options — Security Center: Security Center Settings Macro Settings – enable all macros I use Office 2010. in 2007 may be above settings is located in another position. You can search google as “how to enable macro in office 2007” and you will find it. regards, Yilmaz. However, it didn’t work when I replied to an e-mail from my notebook and, as mentioned above, I suspect it may not work if I forward an e-mail from the notebook. Are there any similarly easy solutions out there – short of buying software? Again, thanks. strBcc = “SomeEmailAddress@domain.com” Set objRecip = Item.Recipients.Add(strBcc) objRecip.Type = olBCC If you want to add more addresses, repeat these lines, replacing the address assigned to strBcc with the extra address. As with the original code, you may want to check that the address is valid (resolves successfully). Any way to code this so that it BCC’s TWO email addresses? I have tried various options but keep getting an “could not resolve the BCC address” error. thanks :-) sandra It worked for me! Thanks! To automatically log outbound mail using bcc Open a terminal window and type the following; defaults write com.apple.mail UserHeaders ‘{“Bcc” = “yourbcc@addresshere.com”; }’ this will automatically bcc any OUTBOUND message from Mac Mail Note: if you wish to remove this rule type; defaults delete com.apple.mail UserHeaders Changes made to your Mac Mail configuration are not supported by anyone. Read more here: http://email.about.com/od/macosxmailtips/qt/et_auto_bcc.htm To automatically log inbound mail you need to create a redirect rule Open Mac Mail preferences and click the Rules tab. Create a new rule matching the condition: “From contains: @”. This will match every email you receive. Choose the “Redirect Message” action, and enter your BCC address (e.g yourbcc@addresshere.com) 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 Dim strSendAccount As String strSendAccount = Item.SendUsingAccount.SmtpAddress Select Case strSendAccount Case “emailaddress1@account.com” ‘### test for first account here strBcc = “bcc1@account.com” ‘### set the corresponding bcc Case “emailaddress2@account.com” strBcc = “bcc2@account.com” Case “emailaddress3@account.com” strBcc = “bcc3@account.com” Case Else ‘if none of the accounts match, then exit Exit Sub End Select 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 Nice tip, thank you… However, when you look in the ‘sent folder’ and open the email it shows the BCC and who it was direct too? Sort of defeats the object? Any idea on how to stop it beeing reveale?d Any idea on how to stop it being revealed? Using latest Outlook client, I can report that it does not work.. :-( Cheers, John I too am having problems with this working after a reboot. A co-worker of mine who is using Outlook 2007, and myself, using Outlook 2010 have the same problem. Even if I changed my macro settings to automatically accept and not prompt it doesn’t matter, it still doesn’t work after a reboot. Any ideas? It worked on one test email, then after rebooting my computer the code no longer works. I do have Outlook 2010. Jack do you have any suggestions as there seems to be a few of us who are experiencing this glitch. Also, is there any way to solve this problem on the exchange server side (so that if people are sending mails from smartphones or web-client as well as client outlook it also works)? Thanks Thank you, this is a great tool. Especially for someone who is tecnologically challenged like myself. However, I have a little problem…can I get it to work on reply emails and forward emails? Would love someone to point me in the right direction Cheers Donna thanks a lot for this precious tip. I have faced the same problem reported by many users above. In less than a month, the auto bcc has stopped working. Thanks Buddy So here’s a solution for people who find this STOPS WORKING after a day, or after computer restart.
- In Outlook 2010, go to File -> Options -> Trust Center 2. Click Trust Center settings 3. Click Macro Settings 4. Choose “Notifications for all macros” 5. OK everything 6. Restart Outlook 2010 7. You’ll get a security warning – you’ll need to grant permissions to get the macro to run. It should now work HTH and thanks for the tip so happy thanks so much thanks /A 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 = “mailadresi1@mail.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 ‘ repeat the group start form “x” to “y” for more than two mails. ‘ x strBcc = “mailadresi2@mail.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 ‘y Set objRecip = Nothing End Sub strBcc = “SomeEmailAddress@domain.com” to strBcc = “”SomeEmailAddress@domain.com” You will probably want to copy and paste the above to get it right. This will not show the email used for bcc but does instead just display ” (empty address), although it appears to be impossible to turn this off completely as if you look at your senders name it ‘fname lname’ in the same quotes, which means all named address’s are quoted, so the best you can do is set it to nothing. Hope that helps someone else out instead of paying out for software to do the same. If anyone has a better solution to hide the BCC recipient please let us know :-) Get the code from here: http://pastebin.com/TmWvB3Ry It works fine for me except when there are internal emails address from my company in the ‘Cc’. When i do that the Bcc don’t work. When in the ‘To’ Field or in the ‘Cc’ are externals email address it work’s fine. Is there any workaround for that? Thanks :) :) Thanks 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 If Item.SendUsingAccount = “ACCOUNT NAME” Then strBcc = “BCC EMAIL ADDRESS GOES HERE” End If Set objRecip = Item.Recipients.Add(strBcc) objRecip.Type = olBCC If Not objRecip.Resolve Then If res = vbNo Then Cancel = True End If End If Set objRecip = Nothing End Sub Please note that the “ACCOUNT NAME” above is the name of the account when you created it can can be found by opening the email account settings, clicking ‘more settings’ then the account name will be under the general tab. Good luck! I want to bcc my emails sent only from the 1 account managed by a provider other than Gmail. The problem I am facing is that all emails that I send, even from my other email IDs are being BCCd back to me. How can I stop this? I have made changes to the relevant portions in the following code: If Item.SendUsingAccount = “ACCOUNT NAME” Then strBcc = “BCC EMAIL ADDRESS GOES HERE” Do I have to remove the “” in the above code? I am using Windows XP with Outlook 2010. thanks much!!! This makes it a little better – If Item.SendUsingAccount = “ACCOUNT NAME” Then strBcc = “BCC EMAIL ADDRESS GOES HERE” Else Exit Sub End If Thanks I’m back to trying to solve the first IMAP problem; how can I get the Outlook IMAP account, myname@gmail.com to send emails that say they are from myname@yahoo.com? Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) Dim objRecip As Recipient Dim strMsg As String Dim email As MailItem 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 Set email = Item strBcc = email.SendUsingAccount.SmtpAddress 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 Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) Dim objRecip As Recipient Set objRecip = Item.Recipients.Add(Item.SendUsingAccount.SmtpAddress) objRecip.Type = olBCC objRecip.Resolve End Sub Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) Dim objRecip As Recipient Set objRecip = Item.Recipients.Add(Item.GetInspector.CurrentItem.SendUsingAccount.SmtpAddress) objRecip.Type = olBCC objRecip.Resolve End Sub This is cool, what I am trying to do is sort of similar to this. What I am trying to do is create VBscript to CC or BCC (it doesn’t matter which) in the mailbox that I am sending from. I have a total of 5 mailboxes, including my personal and 4 shared boxes. I don’t want this applied to my personal or 1 of the shared, so I want to specify the mailbox names that it is being sent from. If it is one of the 3 it will place a copy of the email being sent into the inbox of the mailbox being sent from. I know this can be easily done with creating rules, but we have shared mailboxes and due to how we log in, some people don’t like the rules and they uncheck them, very irritating. Also it appears there is no way to record a macro in Outlook, just create one. I am trying to do something like this: Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) If From = “MailBox1@domain.com” Then Forward.Recipients.Add “MailBox1@domain.com ” End If If From = “MailBox2@domain.com” Then Forward.Recipients.Add “MailBox2@domain.com ” End If If From = “MailBox3@domain.com” Then Forward.Recipients.Add “MailBox3@domain.com ” End If End Sub I am not familiar with VBScript in Outlook at all, starting to get familiar with it in Excel though. Can someone please take a look at this and see if you know how to do this? Thanks, Chris Thanks to a post from Andy that I originally overlooked I figured out how to do this. Andy’s post only utilized 1 mailbox, so I just added two more if/then statements for the other two mailboxes. Here it is. Chris 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 If Item.SendUsingAccount = “mailbox1@domain.com” Then strBcc = “mailbox1@domain.com” End If If Item.SendUsingAccount = “mailbox2@domain.com” Then strBcc = “mailbox2@domain.com” End If If Item.SendUsingAccount = “mailbox3@domain.com” Then strBcc = “mailbox3@domain.com” End If Set objRecip = Item.Recipients.Add(strBcc) objRecip.Type = olBCC If Not objRecip.Resolve Then If res = vbNo Then Cancel = True End If End If Set objRecip = Nothing End Sub Chris 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 If Item.SendUsingAccount = “mailbox1@domain.com” Then strBcc = “mailbox1@domain.com” Else If Item.SendUsingAccount = “mailbox2@domain.com” Then strBcc = “mailbox2@domain.com” Else If Item.SendUsingAccount = “mailbox3@domain.com” Then strBcc = “mailbox3@domain.com” End If End If End If Set objRecip = Item.Recipients.Add(strBcc) objRecip.Type = olBCC If Not objRecip.Resolve Then If res = vbNo Then Cancel = True End If End If Set objRecip = Nothing End Sub I hope you can help me. This is almost what I need. However, I also need to able to differentiate by Subject line to include or exclude BCC. Do you have any idea on how to do that? Or maybe someone else here can help? Thanks, Frank There are 4 posts from me, 1 asking the question and 3 answers. The most recent answer is the best solution. Look for the newest post by zines, this solves the issue when the email is saved as a draft. Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) Dim objRecip As Recipient On Error GoTo Fin Set objRecip = Item.Recipients.Add(Item.GetInspector.CurrentItem.SendUsingAccount.SmtpAddress) objRecip.Type = olBCC objRecip.Resolve Fin: End Sub Exactly what i was looking for. Thanks! This will only BCC the mailbox of the mailbox being sent from and you have to specify which mailboxes being sent from. For example, we have 5 mailboxes in our group but only want 3 of the mailboxes to BCC in, so the code is designed to only BCC in 3 of the mailboxes, instead of all 5. You can easily customize it to BCC in how many mailboxes you want. All you need to do is to delete 2 of the 3 if/then statements if you only want one mailbox or add more if you want more than 3, etc. The part that needs to be edited is where it says mailbox@domain.com. Overwrite those mailboxes with your mailboxes. The solution I came up with was creating a rule in Outlook that applied to all email I sent, it would ‘move a copy to a specific folder’, and I created no exceptions. I named it BCC so I’d remember what the rule does. If Item.Categories = “Personal” Then Exit Sub Else However, those “personal” addresses are still being BCC’d. Is there a way to select certain addresses (about 10 in all) that I never want to be BCCd? http://answers.groovypost.com/questions/2099/outlook-2010-vbscript-to-cc-or-bcc-in-the-inbox-that-is-being-sent-from?page=1#2185 However, I do not want personal mail being bcc’d to this address. So the number of addresses that I DO want bcc’d will be in the many hundreds, and will grow each day. The number of addresses that I do not want to have mail bcc’d to is about 10. I am currently achieving this nicely with Ablebits’ Auto BCC but it costs $$ so I’m hoping to the same thing with VBA. 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 If Item.SendUsingAccount = “MYACCOUNT” Then strBcc = “1EMAIL” 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 End If If Item.SendUsingAccount = “MYACCOUNT” Then strBcc = “2EMAIL” 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 End If If Item.SendUsingAccount = “MYACCOUNT” Then strBcc = “3EMAIL” 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 End If Set objRecip = Item.Recipients.Add(strBcc) objRecip.Type = olBCC If Not objRecip.Resolve Then If res = vbNo Then Cancel = True End If End If Set objRecip = Nothing End Sub 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 If Item.SendUsingAccount = “MYACCOUNT” Then strBcc = “1EMAIL” 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 End If If Item.SendUsingAccount = “MYACCOUNT” Then strBcc = “2EMAIL” 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 End If If Item.SendUsingAccount = “MYACCOUNT” Then strBcc = “3EMAIL” 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 End If Set objRecip = Nothing End Sub I’ve had this working successfully for a long time but recently added a secondary email account to Outlook and now I receive the “Could not resolve…” error when I try to send. Any suggestions? Thanks So if i wanted to add a colour category and category text to the bcc email how would I do that? so if i add a colour category…i can filter and auto move it to another folder…. thanks! Thanks, ken@themurrayfamily.org Does anyone have a work around for Outlook 2013? If so will this enable the same settings in Office 365 by chance? Any feedback would be greatly appreciated! Thanks for this usefull tutorial..!! what i have to do to add multiple bcc recipients on the original code which you provide. Could you provide me with the code with mutiple recipients. Thanks E.Manolis Thank you very much. It works for me. Rgds, Fea Thanks very much for the post. I have followed the steps in Outlook 2010 – it worked for the first day, but (even after adjusting the macro security to ‘notifications for all macros’ and then clicking ‘enable macros’ on re-start of the programme), it is failing to work now (the 2nd day)?? Any help much appreciated! Thanks They light up “red” and I receive the below error message Compile error Expected: end of statement What am I doing wrong? Thanks I was having the same issue and what did it for me was changing the quotes. When I used copy and paste, there were slanted type quotes, when I replaced those with the quotes from my keyboard everything was OK
- I have 3 email addresses – one is via an exchange mailbox and the other two are provided through Google. Is it possible to edit the script so it ignores mail sent from the other email addresses and only sends the BCC from one of the accounts (one of the Google accounts)?
- Can the code be edited so it works for forwards or replies? This would turn something good into something GREAT! Private Sub Application_Startup() Set myOlInspectors = Application.Inspectors End Sub Private Sub myOlInspectors_NewInspector(ByVal Inspector As Outlook.Inspector) Dim Item as mailitem If Inspector.CurrentItem.Class = olMail Then Set Item = Inspector.CurrentItem If Item.Sent Then Debug.Print “Reading a received mail.” Else With Item Dim objRecip As Recipient Dim strBcc As String On Error Resume Next strBcc = “YourEmail@here.com” Set objRecip = Item.Recipients.Add(strBcc) objRecip.Type = olBCC Set objRecip = Nothing End With End If End If End Sub Could anyone help me, I have the following macro, and would like to add another e-mail address, any idea? Private Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean) Dim objMe As Recipient Set objMe = item.Recipients.Add(“alba573@gmail.com”) ‘adres to youre boss objMe.Type = olBCC objMe.Resolve Dim strMessageClass$ strMessageClass = item.MessageClass If (strMessageClass = “IPM.Note”) Then item.OriginatorDeliveryReportRequested = False item.Save End If Set objMe = Nothing End Sub I cc. myself with a rule as it keeps me on top of email admin / latest sent message without having to look at sent items, and I’m able to always delete old messages in the thread. I get curious questions from e.g. my boss asking why I copy myself in, which makes me feel as if it looks silly to others, or over-officious. So this is a much better way of doing it! so, works email send to specific email and bcc home email? can anyone help me with this? thanks The OTM file asks the users if they would like to send a copy of the mail there sending to a predefined mailbox (BCC) What I need to do is change the script so it reads group membership of the user and based on the group membership gives them a drop down box. this drop down will give them a choice of mailboxes to BCC the mail to. for example If user A is a member of group DomainprojectA and domainProjectB then the dropdown would give the user the drop down box when sending a mail to choose between the projectA and Project B mailboxes for Bcc. Is the above possible? the current OTMfile has the below code in it. I hope this is possible Thanks chris objItem.Subject = Format(objItem.SentOn, “YYYY-MM-DD HH:MM:SS”) & “-” & objItem.Subject objItem.Save End If End If Next Set objItem = Nothing Set objNS = Nothing Set objApp = Nothing End Sub Sub Create_Button() Dim cbTesting As CommandBar Dim ctlCBarButton As CommandBarButton Dim ctlCBarCombo As CommandBarComboBox Dim ctlCBarPopup As CommandBarPopup On Error Resume Next Set cbTesting = Application.ActiveExplorer.CommandBars(“Shepherd”) If Err = 0 Then cbTesting.Delete End If Set cbTesting = Application.ActiveExplorer.CommandBars _ .Add(Name:=”Shepherd”, Position:=msoBarTop) Set ctlCBarButton = cbTesting.Controls.Add(Type:=msoControlButton) With ctlCBarButton .Caption = “Date Stamp” .FaceId = 2167 .Style = msoButtonCaption .Visible = True .OnAction = “Project1.ThisOutlookSession.DateStamp” .TooltipText = “Date stamp an item of mail with the received date” End With cbTesting.Visible = True End Sub Sub CCProjMail() ‘by Allan Scott Sub Application_ItemSend(ByVal MailItem As Object, Cancel As Boolean) Dim projMail As String Dim ask As String ask = MsgBox(“Send a copy to ‘Computer Helpdesk’ Project Mail Box?”, _ vbYesNo + vbQuestion, “Project eMail”) If ask = vbNo Then ‘Resolve the address MailItem.Recipients.ResolveAll MsgBox (“Your email will be sent as normal”), vbOKOnly + vbInformation Else: ask = vbYes projMail = (“”) MailItem.CC = MailItem.CC & “;” & projMail ‘Resolve the address MailItem.Recipients.ResolveAll MsgBox (“Your email will be sent with a copy sent to ‘Computer Helpdesk’ Project Mail Box”), _ vbOKOnly + vbInformation End If End Sub Several different iterations of the script worked fine with Outlook 2013 and Office 365, but I just updated to Windows 10 and then Office 365 2016 and this no longer works… I don’t even get a popup asking me to verify the security certificate like I did in Outlook 2013. ‘ #### USER OPTIONS #### ‘ address for Bcc — must be SMTP address or resolvable ‘ to a name in the address book strBcc = “XXXXX-XXXXXXXX@mailbox.insight.ly” 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 Sure enough, it did. Time will tell if it lasts…. Thanks for any tips you can provide. 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 Dim strSendAccount As String strSendAccount = Item.SendUsingAccount.SmtpAddress Select Case strSendAccount Case “Send@test.com” ### Send Mail Address strBcc = “BCC@test.com” ### BCC Mail Address Case Else Exit Sub End Select 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 This will do basically the same thing without the macro. The VBA works very well by the way Set objRecip = Item.Recipients.Add(“example1@domain.com”) objRecip.Type = olBCC objRecip.Resolve Set objRecip = Item.Recipients.Add(“example2@domain.com”) objRecip.Type = olBCC objRecip.Resolve (Initial instructions and code works fine for single Bcc recipient.) The code works well for me, with new emails, forwards, and replies. However, I’m looking for a way to exclude the BCC if the email is sent to specific email addresses. Kind of like when setting up a rule you can list emails as an “except if sent to…”. I have two different jobs in my company and I don’t want to BCC myself if the email is sent to people in my company from the first job. I have a list of emails I can exclude, but I don’t know how to add it to VBA code. Any idea? Thanks! Is there a way for the code to have the email i chose to bcc to show up on my emails before i send them out? Thanks, I am using this instead of the hubspot add-in that causes my outlook 2016 to become totally unresponsive. My need is slightly different. I want control over which outgoing emails this is activated on and wonder if it can be run from a button ie a macro button that adds the desired email address to the bcc field is there a way, when you go to the sent items that the sent email do not show that there was a bc in that particular email? I can get the basic code to work for all email accounts, but not if I try to use it for certain accounts or if I want it to prompt for the Bcc. I get compile errors. The errors include expected end of line and the line stays red. I want to Bcc to a POP3 address when I send from an outlook.com or gmail.com address. Any ideas how I can get this working? Many thanks. Matt Dim objRecip As Recipient Dim strMsg As String Dim res As Integer Dim strBcc As String On Error Resume Next If Item.SendUsingAccount = “xxxx@gmail.com” Then (ERROR) strBcc = “”” Else If Item.SendUsingAccount = “xxxxx@outlook.com” Then (ERROR) strBcc = “”” End If End If Set objRecip = Item.Recipients.Add(strBcc) objRecip.Type = olBCC If Not objRecip.Resolve Then If res = vbNo Then Cancel = True End If End If Set objRecip = Nothing Any ideas where I am going wrong? Many thanks. Matt Make sure you are not using SmartQuotes. The lines have error at the end….. I will try without the quotes…. they might have been on it….. Cheers. Matt Has anyone else noticed this? 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 Dim objMsg As Outlook.MailItem On Error Resume Next ‘ #### USER OPTIONS #### ‘ Address for Bcc — must be SMTP address or resolvable ‘ Automatically selects the bcc address from the set “from” setting or ‘ to a select email address, your choose strBcc = “xxx@xxxx.co.uk” res = MsgBox(“Would you like to receive a copy of this message (Bcc)?”, vbYesNo + vbDefaultButton1, _ “BCC Message”) If res = vbNo Then Cancel = False Else Set objRecip = Item.Recipients.Add(strBcc) objRecip.Type = olBCC objRecip.Type = Outlook.OlMailRecipientType.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 End If Set objRecip = Nothing End Sub Cheers. Matt Erm..no that’s not true for me. I followed all your instructions in your post (I didn’t use any code inside the comments), and the BCC worked EXCEPT that I can see the strBcc value (i.e., the hidden recipient’s email) appear inside the BCC: field just before the email gets sent out. Of course I enabled the Bcc field to show up by clicking on “New E-mail|Options|Show fields Bcc”. Even if I didn’t enable the Bcc field, all I need to do is to click on one of my sent email messages inside my “Sent items” folder. I can clearly see the “To:”, “Cc:” AND the “Bcc:” values. The “Bcc:” value being the hidden recipient’s email address. This pretty much puts the spanner into the works if I want to setup a “stealthy BCC” on another person’s Microsoft Outlook. So much for stealth. Anyone face the same problem as I? All the other links in google were trying to sell me an add-on :/ Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) Dim objMe As Recipient Set objMe = Item.Recipients.Add(“xxxxxx@gmail.com”) ‘address to your boss objMe.Type = olBCC objMe.Resolve Set objMe = Item.Recipients.Add(“xxxxxxx@outlook.com”) ‘address to your boss objMe.Type = olBCC objMe.Resolve Dim strMessageClass$ strMessageClass = Item.MessageClass If (strMessageClass = “IPM.Note”) Then Item.OriginatorDeliveryReportRequested = False Item.Save End If Set objMe = Nothing End Sub Comment Name * Email *
Δ Save my name and email and send me emails as new comments are made to this post.