Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Connect to Microsoft Exchange

by libvenus (Sexton)
on Nov 25, 2010 at 16:58 UTC ( #873683=perlquestion: print w/replies, xml ) Need Help??

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

Hi Monks,

I have been assigned a task to connect to a microsoft exchange server and read the emails for a particular user.The script will sit on a unix machine and keep probing the email account.I tired using Net::POP3 but it failed probably because of the port being blocked.

Is there some other way in which i can access the email account?

Thanks in advance.

Replies are listed 'Best First'.
Re: Connect to Microsoft Exchange
by chrestomanci (Priest) on Nov 25, 2010 at 17:13 UTC

    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?

      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". ;-)
Re: Connect to Microsoft Exchange
by aquarium (Curate) on Nov 26, 2010 at 04:27 UTC
    it's quite likely imap or even the default exchange protocol, but either way the authentication is probably as part of the logon to a workstation...and without exchange admin help regards exact alternative authentication using a script, you'll be struggling to get anywhere...and maybe you'll end up getting noticed by locking someone's email/logon account. it's illegal in most countries to eavesdrop without good reason and proper authority. the simplest way is for the exchange admin to setup a invisible automated cc or forward to another address.
    the hardest line to type correctly is: stty erase ^H
Re: Connect to Microsoft Exchange
by sundialsvc4 (Abbot) on Nov 29, 2010 at 13:17 UTC

    You are definitely at the point where you need technical assistance from the Exchange support team.   You need to look at the application logs of Exchange, and you might not have access to them.   The problem can likely be resolved quickly, but perhaps not with the information you now have available to you.   Don’t whack your head too much against problems like these.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://873683]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2020-07-08 09:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?