Confusing tlsmail error Bad login (Net::POPAuthenticationError)

I am trying to execute an example listed on
http://rubydoc.info/gems/tlsmail/0.0.1/frames.

example code begins with:
#require ‘net/pop’

#pop = Net::POP3.new(‘pop.example.com’)
#pop.start(‘YourAccount’, ‘YourPassword’) # (1)
[etc. elided …]

I copied the complete example to a file, filled in my
server/username/password info, ran it and go this error:

ruby /users/tburns/ruby/getmail.rb
/usr/lib/ruby/1.8/net/pop.rb:864:in check_response_auth': -ERR Bad login (Net::POPAuthenticationError) from /usr/lib/ruby/1.8/net/pop.rb:766:inauth’
from /usr/lib/ruby/1.8/net/pop.rb:445:in do_start' from /usr/lib/ruby/1.8/net/pop.rb:432:instart’
from /users/tburns/ruby/getmail.rb:4

Apparently it bombs when executing the start method.

I am able to download email from that account with the same
username/password in thunderbird, without special ports or anything. I
am not strong in ruby yet, and I have no idea how to troubleshoot
this. I googled `check_response_auth’: -ERR Bad login
(Net::POPAuthenticationError), got few hits, none helpful.

Could it be an SSL thing? I think the server is happy with or without
ssl.

Anyone have a clue for me?
mahalo,
Dave

David B. wrote in post #981887:

/usr/lib/ruby/1.8/net/pop.rb:864:in `check_response_auth’: -ERR Bad
login (Net::POPAuthenticationError)

“-ERR Bad login” is the actual response from the POP3 server. It means
you gave a bad username or password.

I am able to download email from that account with the same
username/password in thunderbird, without special ports or anything.

First try using telnet:

telnet pop.example.com 110
CAPA
USER username
PASS password
QUIT

If you get +OK then you logged in successfully. If you get -ERR then the
username and/or password is incorrect.

If you get -ERR then paste the transcript to the mailing list, blanking
out the password you tried, and we may be able to determine more from
what’s seen.

Could it be an SSL thing?

No. You would not be able to see -ERR in that case.

Oops, never mind. I was having a problem earlier with the password, so
I changed it, but did not update the test code. DOH!

Thanks to Brian C. for clarifying.

On Tue, Feb 15, 2011 at 10:55 AM, David B. [email protected] wrote:

I am trying to execute an example listed on
http://rubydoc.info/gems/tlsmail/0.0.1/frames.

Anyone have a clue for me?
mahalo,
Dave

In case anyone cares, here is how I debugged… The run bombs during
check_response_auth, defined as:

def check_response_auth(res)

raise POPAuthenticationError, res unless /\A+OK/i === res

res

end

I changed that to debug as follows:
#grep -A5 ‘def check_response_auth’ /usr/lib/ruby/1.8/net/pop.rb

def check_response_auth( res )

puts res

raise POPAuthenticationError, res unless /\A+OK/i === res

res

end

AFter that, the run looks like:

ruby ruby/getmail.rb
+OK User name accepted, password please
-ERR Bad login
/usr/lib/ruby/1.8/net/pop.rb:865:in check_response_auth': -ERR Bad login (Net::POPAuthenticationError) from /usr/lib/ruby/1.8/net/pop.rb:766:inauth’
from /usr/lib/ruby/1.8/net/pop.rb:445:in do_start' from /usr/lib/ruby/1.8/net/pop.rb:432:instart’
from ruby/getmail.rb:4

So we see the username is accepted, but then the password rejected.

Dave

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs