/**
* Script: readMail.js
* Purpose: Opens the Inbox for the Outlook profile defined
* and reads the message contents then displays them
* to a user.
* Author: Daren Thiel
* Date: 24 November 1998
* Web: http://www.winscripter.com
* Note: If the message are large the WScript.Echo box will
* be larger than the screen area. By default the OK
* button is selected, so pressing enter will clear the
* popup from view.
**/
/* Set the name of the profile to use */
var profile = "Microsoft Outlook Internet Settings";
/* Create a MAPI Session Object */
omapi = new ActiveXObject( "MAPI.Session" );
/* Open the profile of where we want to store the address */
omapi.Logon( profile );
/* Create an object for the Inbox of this profile */
objFolder = omapi.Inbox;
/* Create an object for the Messages */
objMsg = objFolder.Messages;
/**
* Get the first message. Depending on how the Inbox
* is sorted will determine which Message is considered
* the first message.
**/
myMsg = objMsg.GetFirst();
/* Retrieve the body of the message */
msg = myMsg.Text;
/* Display the message to the user */
WScript.Echo( msg );
/* Loop through the first 10 messages and display */
for ( i = 0; i < 10; i++ )
{
myMsg = objMsg.GetNext();
msg = myMsg.Text;
WScript.Echo( msg );
}