IMAP TLS login problem

I’m sure this is straight forward but for once Google is failing me.
I’m trying to access an IMAP server with a Ruby script. The INMAP
server is using TLS and its working OK (I’ve test manually with
openssl). But this simple Ruby script can’t login:

require ‘net/imap’
require ‘openssl’

imap =‘’, port = 993, usessl =
p imap.capability
#imap.authenticate(‘cram-md5’, ‘’, ‘’)
imap.authenticate(‘login’, ‘’, ‘’)

stuff that never gets runs yet …

The result is as below. ‘Capability’ works OK. I was expecting
“AUTH=LOGIN” as well, but I know ‘LOGIN’ does work as I can do it
manually with openssl s_client. Any ideas?

[[email protected]]$ ./imap1.rb
/usr/lib/ruby/1.8/net/imap.rb:974:in get_tagged_response': Command Argument Error. 11 (Net::IMAP::BadResponseError) from /usr/lib/ruby/1.8/net/imap.rb:1023:insend_command’
from /usr/lib/ruby/1.8/monitor.rb:238:in synchronize' from /usr/lib/ruby/1.8/net/imap.rb:1008:insend_command’
from /usr/lib/ruby/1.8/net/imap.rb:357:in `authenticate’
from ./imap1.rb:9

Well, how about that - it seems that if I use
instead of …
imap.authenticate(‘login’, ‘’, ‘’)
then it works. Happy days are here again.

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