I need some expert advice/guidance. I'm trying to use a Net::POP3 object to talk to our Exchange server. From my desktop PC (running 5.8.0 ActiveState, Windows 2000, Service Pack 4) which is behind our firewall, I can retrieve the messages in my inbox. The Exchange server is also behind the firewall. All is well, I have proof of concept.

I can't have production code on my desktop, so I moved the code to our FTP server (running 5.6.1 ActiveState, Windows 2000, Service Pack 4), in the DMZ. I put the Exchange server in the local hosts file, ran the code, and get the following:

Can't open connection to ms240ex02.sysco.com : Unknown error

I get no more information when I create the object with Debug => 1. My code is simple --

# # use strict; use Net::POP3; my $server = "ms240ex02.sysco.com"; my $username = "valid_user"; my $password = "valid_password"; my $messages; my $message; my $msgid; my $pop = Net::POP3->new($server, Debug => 1) || die "Can't open connection to $server : $!\n"; defined ( $pop->login($username, $password) ) || die "Can't authenticate: $!\n"; $messages = $pop->list || die "Can get list of messages : $!\n"; foreach $msgid (keys %$messages) { $message = $pop->get($msgid); if ( $message ) { #succeeded print "\n"; print @$message; } else { #failed warn "Couldn't fetch $msgid from mail server ; $!\n"; next; } }
I've looked in the docs, and can't find any more information about what may be going on, so came to the Monks for expert advice!

My ultimate goal is to check the contents of an inbox using perl, tapping the Exchange server from a remote host.

Suggestions/comments/advice, always welcome!


In reply to Net::POP3 by jarp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.