CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Reading a POP3 server with Net::POP3

 



Bakuras
Deleted

Sep 30, 2000, 7:16 PM

Post #1 of 10 (1150 views)
Reading a POP3 server with Net::POP3 Can't Post

I've tried everything. I've read every single documentation on the module that I could find and still none of my cgi's are working. I've come to suspect that although my web host has the Net::POP3 module, something else might be wrong. Here's my code which tries to read the pop3 server, no more and no less:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


#!/usr/bin/perl

use Net::POP3;

$server = "theserver.com";
$user = "theuser";
$pass = "thepassword";

print "Content-type: text/html\n\n";

$pop = Net::POP3->new($server);
$count = $pop->login($user,$pass);
$pop->quit();
print "$count";
exit;
</pre><HR></BLOCKQUOTE>

I'm expecting it to be something incredibly simple that I missed, but then again it could aslo be incredibly complicated o_O;;
I've never worked with these types of programs before so I suppose it could be anything ^_^;; Thanks for all your help! Smile


dws
Deleted

Sep 30, 2000, 8:35 PM

Post #2 of 10 (1150 views)
Re: Reading a POP3 server with Net::POP3 [In reply to] Can't Post

"none of my cgi's are working."

Are you sure that Perl is in /usr/bin? Some ISPs put in in /usr/local/bin, or make you explictly say /usr/bin/perl5.

If you have shell access, what happens when you run the CGI from the command line?

Assuming that this is an "it's just dying quietly" type of thing, try adding

BEGIN { $|++; print "Content-type: text/html\n\n" };

to the top of the file, to force the content header out first.


Bakuras
Deleted

Sep 30, 2000, 9:23 PM

Post #3 of 10 (1150 views)
Re: Reading a POP3 server with Net::POP3 [In reply to] Can't Post

Oh no sorry for the misunderstanding! I run many cgi scripts from my site, i meant to say that only my cgi's that have anything to do with Net::POP3 never work ^^;;
Thanks i'll try what you suggested Smile


Bakuras
Deleted

Sep 30, 2000, 9:29 PM

Post #4 of 10 (1150 views)
Re: Reading a POP3 server with Net::POP3 [In reply to] Can't Post

Nope still no go Frown
I tried debbugging it with the die option and I found out that,
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


$pop = Net::POP3->new($server);
</pre><HR></BLOCKQUOTE>, doesn't return a value at all. I've tried it with several different servers and cross checked it by running the server
names through pop3 programs like outlook and several free services on the web so I know for a fact that the server names are working, but as of yet I have been unable to create a new pop3 object Frown

[This message has been edited by Bakuras (edited 09-30-2000).]


Bakuras
Deleted

Oct 3, 2000, 8:26 PM

Post #5 of 10 (1150 views)
Re: Reading a POP3 server with Net::POP3 [In reply to] Can't Post

I'm totally stumped. I have no idea why this isn't working Frown
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


$pop = Net::POP3->new($server);
</pre><HR></BLOCKQUOTE>


dws
Deleted

Oct 4, 2000, 10:00 AM

Post #6 of 10 (1150 views)
Re: Reading a POP3 server with Net::POP3 [In reply to] Can't Post

Are you sure that whatever server $server refers to is still accepting POP3 connections? Try manually telneting to port 110 (pop3) of that server and type HELO.


Bakuras
Deleted

Oct 4, 2000, 4:58 PM

Post #7 of 10 (1150 views)
Re: Reading a POP3 server with Net::POP3 [In reply to] Can't Post

Ok I did that and this is what I got:
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


+OK POP3 usa4.hostrack.net v7.59 server ready
hello
-ERR Unknown AUTHORIZATION state command
</pre><HR></BLOCKQUOTE>
It seems that it works though, I went over to hypermart and ran the script and the code works perfectly o_O;; But for some reason even though the Net::POP3 module is installed on my host's system it doesn't connect at all o_O;; Any ideas?


dws
Deleted

Oct 5, 2000, 4:45 AM

Post #8 of 10 (1150 views)
Re: Reading a POP3 server with Net::POP3 [In reply to] Can't Post

Type "HELO", not "hello". No matter. What that confirms is that the POP3 server requires authorization.

For better visibility into what's failing, try:

$pop = new Net::Pop3($server, Debug => 2);



Bakuras
Deleted

Oct 5, 2000, 9:47 PM

Post #9 of 10 (1150 views)
Re: Reading a POP3 server with Net::POP3 [In reply to] Can't Post

It has to be server specific, i tried the same script at hypermart and it worked perfectly o_O;; For some reason my host isn't working with this script.
Here's the error I got with my normal web host after running that debug parameter you suggested:
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


cannot make connection to server
</pre><HR></BLOCKQUOTE>
and that's all that the script will generate o_O;;
I suppose that I better find a better module to work with on my server ^_^;;


dws
Deleted

Oct 6, 2000, 10:06 AM

Post #10 of 10 (1150 views)
Re: Reading a POP3 server with Net::POP3 [In reply to] Can't Post

Could be a routing problem, or it could be that for whatever reason the folks who run the mail server have decided that one of the machines you run on is machina non grata. Can you ping the server?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives