Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Net::POP3 has login failure

by diskcrash (Hermit)
on Oct 25, 2005 at 18:38 UTC ( #502831=perlquestion: print w/ replies, xml ) Need Help??
diskcrash has asked for the wisdom of the Perl Monks concerning the following question:

Wise Monks, here is a POP3 mystery.

I can use the following code snippet to get POP mail from other servers, but not from the one this code runs on. I have used several versions of the user name, including using the full domain name. The debug output at the end seems to show that the login fails on the password. I have turned on and off dovecot, no effect. Evolution works as does the mail command, but not Net::POP3. This is on Fedora Core 4, with a one week old yum update. I have also used the POP3 apop() method, no effect. I've searched in PM and pickings are thin on Net::POP3. The MTA is sendmail.
Your advice would be most appreciated!

David Drake
#!/usr/bin/perl -w use strict; # File readpop.pl # David Drake use Net::POP3; use Mail::Header; use FileHandle; use Net::SMTP; #to send mail use Time::Local; # for seconds from 1/1/1970 usage # Here we create the pop object and attempt to login my $pop = Net::POP3->new('goodhost.com', Timeout => 10, Debug =>1) or +die "Cant connect to host: $!\n"; #we have connected successuflly my $muser = 'goodname'; my $passwd='goodpass'; $pop->login($muser,$passwd) or die "No Login ",$pop->message; #The above generates the login error die "Success\n"; ************************************************** Here is the output, from the POP3 debug # ./readpop.pl Net::POP3>>> Net::POP3(2.28) Net::POP3>>> Net::Cmd(2.26) Net::POP3>>> Exporter(5.58) Net::POP3>>> IO::Socket::INET(1.27) Net::POP3>>> IO::Socket(1.28) Net::POP3>>> IO::Handle(1.24) Net::POP3=GLOB(0x9ef7988)<<< +OK Hello there. Net::POP3=GLOB(0x9ef7988)>>> USER goodname Net::POP3=GLOB(0x9ef7988)<<< +OK Password required. Net::POP3=GLOB(0x9ef7988)>>> PASS .... Net::POP3=GLOB(0x9ef7988)<<< -ERR Login failed. No Login Login failed.

Comment on Net::POP3 has login failure
Download Code
Re: Net::POP3 has login failure
by tirwhan (Abbot) on Oct 25, 2005 at 19:19 UTC

    Are you sure this dovecot instance allows for plaintext passwords? Check the dovecot configuration file for the for the setting

    auth_mechanisms = plain

    if it's set to only allow other authentication mechanisms (CRAM-MD5 or DIGEST-MD5)you'll have to use those. Also take a look at the logs if you have access, dovecot is usually rather helpful in what it tells you about errors.

    Other than that, it may be helpful to look at the network traffic Evolution generates when connecting to the server successfully, as well as the traffic when your script connects. Here's a node I wrote in response to a different question, explaining some ways of how to do this.

      I have been studying the dovecot.conf file closely. Yes, the
      auth_mechanisms = plain
      is set. I have found some examples of dovecot.conf files and I'm trying them out. So far the same symptoms appear. I did notice that I get the same login error when I use either a good or bad user names and passwords. Work in progress and thanks for the tip.
      DD
Re: Net::POP3 has login failure
by spiritway (Vicar) on Oct 26, 2005 at 04:58 UTC

    I'm kind of grasping at straws, but I'm wondering whether you perhaps are sending something other than the correct password - such as, one followed by a newline or some other character. You might try printing out your variable surrounded by some marker character:

    print "*$passwd*";

    to see if you get something like *goodpass *, with a non-printing character at the end (before the final asterisk).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://502831]
Approved by Tanktalus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2014-09-23 03:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (210 votes), past polls