in reply to Connect to Microsoft Exchange

Which version of Exchange?

Did you Search CPAN for Exchange? There look to be several worthwhile modules there.

I am connecting to my company's Exchange server over IMAP, so you might take a look at the IMAP related libraries on CPAN.

Do you have any control over the Exchange server, either directly or by asking the admin nicely? Could you get that POP3 port opened?

Replies are listed 'Best First'.
Re^2: Connect to Microsoft Exchange
by libvenus (Sexton) on Nov 25, 2010 at 17:57 UTC

    The version of exchange I believe is 2007. Yes I have taken a look at IMAP family of Modules but the problem is privileges to install a module. Net::POP3 is already installed so gave it a try but it is not working. Here is that i used:

    use strict; use warnings; use Net::POP3; my $pop = Net::POP3->new('abc.xx.com'); if ($pop->login('XXXX', 'YYYYYYY') > 0) { my $msgnums = $pop->list; # hashref of msgnum => size foreach my $msgnum (keys %$msgnums) { my $msg = $pop->get($msgnum); print @$msg; #$pop->delete($msgnum); } } $pop->quit;

    As far as control over the exchange server is concerned i think that would be a problem.

    Thanks

      You don't need privileges to install modules. You would only need them if you wanted to install them for all users. Obligatory link: Yes, even you can use CPAN.

      Regarding access to Exchange, you could use:

      • SMTP (only useful for sending e-mails)
      • POP3 (may be disabled)
      • IMAP (may be disabled)
      • OWA (Outlook Web Access), i.e. HTTP, HTML, Javascript and some DAV variant
      • Some propritary protocol used by Outlook

      Ask the Exchange admin(s), or use a quick TCP connect port scan.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

        Thanks Alexander

        I installed Mail::IMAPClient but i m not able to connect to the exchange server.

        use strict; use warnings; use Mail::IMAPClient; my $imap = Mail::IMAPClient->new( Server => 'XXXX.YYYY.com', User => 'XXXX', Password => 'YYYY', Ssl => 1, Uid => 1, ); my $folders = $imap->folders or die "List folders error: ", $imap->LastError, "\n"; print "Folders: @$folders\n";
        Thanks