shivag has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks, I am trying to write an application in perl to process messages in a exchange server mail box. Can anyone help me around with pointers in using MAPI? I cannot use POP & IMAP as they are blocked on the server. Thanks in advance - Shiva

Replies are listed 'Best First'.
Re: Perl MAPI to access Exchange Server
by pKai (Priest) on Aug 06, 2007 at 11:47 UTC
      Thanks this one helped me. I am looking for more. But, this is a good starting point where I can get something done. - Shiva
        Now I have got all the messages and I am trying to get the main parts of the message From: To: Subject: Body: I am able to get $msg->{Subject} and $msg->{Text}. how do I get the other 2, also I would need the date and time of message. Thanks again for your time. PS: I am using the WIN32::OLE
Re: Perl MAPI to access Exchange Server
by Anonymous Monk on Aug 06, 2007 at 10:22 UTC
Re: Perl MAPI to access Exchange Server
by Tabari (Monk) on Aug 07, 2007 at 12:03 UTC
    A small script to use outlook for this
    use warnings; use strict; use Win32::OLE; my $outlook = new Win32::OLE 'Outlook.Application' ; $outlook or die "Could not get OLE object for outlook"; my $mailitem = $outlook->CreateItem(0); $mailitem->{'Subject'} = 'A test'; $mailitem->{'Body'} = 'Omnes homines, qui sese praestari volunt, .. +.'; $mailitem->{'To'} = 'mailaddress'; $mailitem->Send(); $mailitem->Quit; $outlook->Quit;
    The e-mail address should be modified, of course
    It also generates a warning message , generated by outlook, to prevent the automatic generation of such messages. Outlook server settings may prevent that, but I don't know the details.
    Tabari
      Hi, I'm writing a perl script to access an Exchange Inbox. Did you managed to do it ? For instance, I'm only able to do this through an Outlook instance. But I would like to connect directly to the Exchange Server. I will be very pleased if you could advice me . Thanks.
Re: Perl MAPI to access Exchange Server
by bingos (Vicar) on Aug 07, 2007 at 08:01 UTC

    Instead of using Win32::OLE directly you could use Mail::Outlook.

      He most probably can't, because he is looking for an alternative to process messages in an Exchange mailbox, where IMAP might not be available.

      MAPI (accessible via Win32::OLE) is meant exactly for this, while Mail::Oulook is only meant to "overcome the problem of sending mail messages, where Microsoft (R) Outlook (R) is the only mail application available."