PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
How to identify mail for specific user
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
How to identify mail for specific user
![]() |
How to identify mail for specific user |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Can anyone tell me if there is a way, using VBA, to
identify messages sent to a specific Outlook user from a specific sender? Ultimately, I will include code that will save, to a network folder, specifically named file attachments that arrive with these messages. An additional objective is to automatically run this code in background not using an Outlook client...or at least not require the above recipient to launch Outlook in order to run this code. I had been considering either running a scheduled task or possibly finding a way to run this code from the mail server. Any thoughts? |
|
|
|
#2 |
|
Guest
Posts: n/a
|
The Recipients collection will tell you who the message was sent to, unless
the recipient got it as a Bcc. As for the sender, you can use SenderName. If you need the address, too, in Outlook 2003, you can use the MailItem.SenderEmailAddress, but note that it's subject to security prompts in certain contexts. In earlier versions, there is no Outlook property that returns the sender's email address. You can either use CDO (or Redemption to avoid security prompts -- http://www.dimastr.com/redemption/) to get the From address or use Outlook to get the Reply To address. Sample code at http://www.outlookcode.com/d/code/getsenderaddy.htm To get the SMTP address from an Exchange sender or recipient, use CDO or Redemption and the PR_EMAIL (&H39FE001E) MAPI property to obtain the SMTP address from the AddressEntry object. See http://www.outlookcode.com/d/code/g....htm#redemption and http://www.cdolive.com/cdo5.htm#EMailAddressOfSender for examples. It is not appropriate to run Outlook automation code on a server or as a scheduled task, because of the likelihood that Outlook will display modal UI that will halt the application. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "MikeC" <anonymous@discussions.microsoft.com> wrote in message news:47fa01c47fe5$3b792550$a401280a@phx.gbl... > Can anyone tell me if there is a way, using VBA, to > identify messages sent to a specific Outlook user from a > specific sender? Ultimately, I will include code that > will save, to a network folder, specifically named file > attachments that arrive with these messages. > > An additional objective is to automatically run this code > in background not using an Outlook client...or at least > not require the above recipient to launch Outlook in order > to run this code. I had been considering either running a > scheduled task or possibly finding a way to run this code > from the mail server. Any thoughts? |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

