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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.