I am trying to learn how to receive and send mail with Perl from a web browser. Have been reading the Perl Cookbook to get a general feel for it by reading/learning about CGI and Net::POP3. Everything has been going pretty well until I actually tried to connect to the POP server.
I keep getting various error messages (that to me at least are not informative) returned. The error is occuring on the constructor for the POP3 object.
Particulars:
code is taken almost verbatim from the Perl Cookbook.
# use strict, warnings and diagnostics # retrieve the pop3 messages eval { print $page -> p(qw(We are going to retrieve the emails here since + you told us to do that.)), "\n"; # open a connection my $pop = Net::POP3->new(Host=>"pop.gmail.com:995") or die("Can't connect to the POP3 server: $! \n"); # log in defined($pop->apop('myaccount@gmail.com', 'mypass')) or die("Couldn't authenticate: $! \n"); # get the message list my $messageList = $pop->list() or die("Couldn't retreive message list: $! \n"); # for each of the messages foreach my $msgid (keys %$messageList) { my $message = $pop->get($msgid); if(defined($message)) { print $message; } else { warn ("Couldn't retreive message. msgId# $msgid"); next; } } }; if ($@) { print "Error occured $@ \n"; }
<Error message returned>
Error occured Can't connect to the POP3 server: Bad file descriptor
</Error message returned>
If I change the POP3 server to something like mail.domain.com, I get the error "Invalid Arguement" rather then Bad file descriptor. I have also tried it with and without the port number (or at least I think that is how you tell it which port to go to) with the same results.
I have read over the Net::POP3 docs on CPAN, reread the "Discussion" provided in Perl Cookbook and still can not figure out where I went wrong. Ideas, Hints, and Suggestions are always greatly appreciated.
In reply to Net::POP3 question by lig
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |