Title: Message
Here's a snippet that will get you started:
 
#Ben Hall
#www.benhall.co.uk
 
use strict;
use Win32::OLE qw(in with OVERLOAD);
 

# outlook profile
my $sender = "Ken Cornetet 1";
my $passwd = ""; # your password here
#
# PROGRAM STARTS HERE
#
# Create a new MAPI Session
#
print "Initialising OLE & MAPI...\n";
 
Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE); # needs this magic incantation
my $session = Win32::OLE->new("MAPI.Session");
if(Win32::OLE->LastError() != 0) {
 die "Could not create a new MAPI Session: ", Win32::OLE->LastError(), "\n";
}
 
#
# Attempt to log on
#
print "Logging on to Exchange server...\n";
 
my $err = $session->Logon($sender, $passwd);
if ($err) {
 die "Logon failed: $!";
}
 
my $store = $session->InfoStores("Mailbox - Ken Cornetet");
my $folder = $store->RootFolder->Folders("Inbox");
 
print "Checking for messages...\n";
 
my $messages = $folder->Messages;
my $message_count = $messages->Count;
my $msg = "";
 
print "\nNumber of messages: ".$message_count."\n";
 
for( my $i=1 ; $i<=$message_count ; $i++) {
 if ($i == 1) {
  $msg = $messages->GetFirst();
 } else {
  $msg = $messages->GetNext();
 }
 print "From: ", $msg->{Sender}->{Address}, "\n";
}
 

$session->Logoff();
 
# end of script
 

 
 
 
-----Original Message-----
From: Raymond Forbes [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 09, 2003 2:08 PM
To: 'Ahlsen-Girard Edward F Contr ESC/ACU OL1'; 'Prohaska, Tim'; [EMAIL PROTECTED]
Subject: RE: reading mail from Exchange

I would like a similar solution if one is possible. 
 
I am making a "heartbeat" check you could say.  I want an account to log in and check mail and i can use that to determine the status of the exchange server.


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ahlsen-Girard Edward F Contr ESC/ACU OL1
Sent: Thursday, October 09, 2003 11:56 AM
To: 'Prohaska, Tim'; Ahlsen-Girard Edward F Contr ESC/ACU OL1; [EMAIL PROTECTED]
Subject: RE: reading mail from Exchange

Not an option - I don't control the server.

-----Original Message-----
From: Prohaska, Tim [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 09, 2003 13:35
To: 'Ahlsen-Girard Edward F Contr ESC/ACU OL1';
[EMAIL PROTECTED]
Subject: RE: reading mail from Exchange


Have you considered using an IMAP client.

-----Original Message-----
From: Ahlsen-Girard Edward F Contr ESC/ACU OL1 [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 09, 2003 12:52 PM
To: [EMAIL PROTECTED]
Subject: reading mail from Exchange



I am trying to get a script to read mail from an Exchange server that does *not* allow POP3 clients.  I want to avoid
opening any windows at all, because this is for an unattended application form processor.  Anyone have any ideas?


  --

Ed Ahlsen-Girard        mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]
Network Administrator   850-882-6540x5349   ESC/ACU OL1
TYBRIN Corporation      DSN:872-6540x5349   205 West D Ave (Bldg 350), Ste 628
LAN Integration         FAX: 850-882-6379   Eglin AFB, FL 32542

http://www.tybrin.com <http://www.tybrin.comhttp://www.eglin.af.mil/mission-planning
<http://www.eglin.af.mil/mission-planning

Reply via email to