Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Retrieving information from incomming mail items. (http://www.outlookbanter.com/outlook-vba/27263-retrieving-information-incomming-mail-items.html)

Jan G. Thorstensen September 17th 06 10:43 PM

Retrieving information from incomming mail items.
 
I am using Outlook2k and WinXP. When a new mail arrives,
I want to get some information like the name of the sender, what is
the subject and body text?

How can I retrieve such properties from the incoming mail item?

I thought this was a good place to start...
Private Sub Application_NewMail()
....code...
End Sub

Any suggestions or code sample is very much apprieciated.


Regards
Jan.



Michael Bauer [MVP - Outlook] September 18th 06 05:45 AM

Retrieving information from incomming mail items.
 
Am Sun, 17 Sep 2006 23:43:57 +0200 schrieb Jan G. Thorstensen:

NewMail fires only once for a bundle of messages. Instead you can use
ItemAdd, which fires for each message as long as there´re not more than 16
at once.

That event has an Item argument, which is a reference to the incoming
message. Simply read its SenderName (that´s the sender´s display name),
Subject and Body properties.

In OL 2000 there´s no way to read the Sender´s address directly. For that
you´d need CDO 1.21 or Redemption (www.dimastr.com).

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --


I am using Outlook2k and WinXP. When a new mail arrives,
I want to get some information like the name of the sender, what is
the subject and body text?

How can I retrieve such properties from the incoming mail item?

I thought this was a good place to start...
Private Sub Application_NewMail()
...code...
End Sub

Any suggestions or code sample is very much apprieciated.


Regards
Jan.



All times are GMT +1. The time now is 06:06 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com