Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / May 2008

Tip: Looking for answers? Try searching our database.

Auto-BCC based on Outlook account

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
yoni - 22 May 2008 11:52 GMT
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("xxx@xxx.com")
   objMe.Type = olBCC
   objMe.Resolve
   Set objMe = Nothing
End Sub

[/code]
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.
Ken Slovak - [MVP - Outlook] - 22 May 2008 14:33 GMT
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.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm

> OK, I know how to add an AutoBCC:
> [code]Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
[quoted text clipped - 11 lines]
>
> Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.