Auto-BCC based on Outlook account

Y

yoni

OK, I know how to add an AutoBCC:
Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)
Dim objMe As Recipient
Set objMe = Item.Recipients.Add("[email protected]")
objMe.Type = olBCC
objMe.Resolve
Set objMe = Nothing
End Sub
The question is, I need to add in that it should only run the BCC if the
emial was sent from a specific account in Outlook?

Thanks.
 
K

Ken Slovak - [MVP - Outlook]

What version of Outlook? In Outlook 2007 you can use the
MailItem.SendUsingAccount property and read that, comparing it with the
NameSpace.Accounts collection of email accounts.

In earlier versions of Outlook there is no direct method of doing that. If
you are using a MAPI wrapper such as Redemption (www.dimastr.com/redemption)
you could use the undocumented properties InetAcctName
("http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8580001E"
in DASL syntax) and InetAcctID
("http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/8581001E"
in DASL). InetAcctID has the email address used to send but you would have
to parse that and if the sending account is from Exchange you would need to
translate the Exchange distinguished name address into an SMTP address.

You can use a MAPI viewer such as MFCMAPI or OutlookSpy (www.dimastr.com) to
look at items and see how those properties are set up and what data they
contain.
 
Joined
Aug 16, 2010
Messages
2
Reaction score
0
Hi,

I'm not great with computers but would be SO grateful if someone could walk me through how to implement this AutoBCC in Outlook. Is it fairly easy? I know I have to use Alt + F11 to get to the module screen, and I changed the (e-mail address removed) and I inserted this code in the ItemSend part, but it's still not Auto-BCCing my emails.

I'm using Outlook 2007.

Please help? Thanks so much!
 
Joined
Jul 31, 2008
Messages
6
Reaction score
0
garson said:
Never mind, I figured it out!
HOW??
Like you, I pasted the code into VBAproject.OTM - ThisOutlookSession (Code) with Application selected on the left and ItemSend on the right.
set strBcc ="(e-mail address removed)"

When I put it in and tested it worked but now it has stopped working!!

Incidentally, I'd quite like to restrict it to just one of the accounts I have set up. But I can use gmail to filter mail from the unwanted accounts if necessary.
 
Joined
Jul 31, 2008
Messages
6
Reaction score
0
SouthendSupporter said:
HOW??
Like you, I pasted the code into VBAproject.OTM - ThisOutlookSession (Code) with Application selected on the left and ItemSend on the right.
set strBcc ="(e-mail address removed)"

When I put it in and tested it worked but now it has stopped working!!

Incidentally, I'd quite like to restrict it to just one of the accounts I have set up. But I can use gmail to filter mail from the unwanted accounts if necessary.

Still trying to solve this problem! Anyone able to help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top