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

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 : 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 = ""; 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!

Replies are listed 'Best First'.
Re: Net::POP3
by pinetree (Scribe) on Oct 31, 2003 at 15:54 UTC

    You mentioned that the Exchange server is behind the firewall and the FTP server in in the DMZ. Have you confirmed that you can connect from the FTP server to the Echange server via POP3?

    Given that turning degugging on in your code didn't give you much additional info, I would start there.


      Other than establishing I can connect to Exchange via POP3 (from behind the firewall), no, I don't know HOW to confirm the Exchange server will talk to the FTP server via POP3. How would I do that?

        from the commmand line on the FTP server type

        telnet exchange_server_IP 110

        you should get a POP3 prompt if all is working well.