imap localhost: Unsupported authentication mechanism.

Discussion in 'Ruby' started by Thufir, Dec 14, 2012.

  1. Thufir

    Thufir Guest

    How do you login to localhost imap?

    code:

    require 'rubygems'
    require 'net/imap'


    imap = Net::IMAP.new('localhost')
    imap.authenticate('LOGIN', 'thufir', 'password')
    imap.examine('INBOX')
    imap.search(["RECENT"]).each do |message_id|
    envelope = imap.fetch(message_id, "ENVELOPE")[0].attr["ENVELOPE"]
    puts "#{envelope.from[0].name}: \t#{envelope.subject}"
    end


    running the code:

    thufir@dur:~/ruby$
    thufir@dur:~/ruby$ ruby imap.rb
    /home/thufir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/imap.rb:1141:in`get_tagged_response': Unsupported authentication mechanism. (Net::IMAP::NoResponseError)
    from /home/thufir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/imap.rb:1195:in `block in send_command'
    from /home/thufir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
    from /home/thufir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/imap.rb:1177:in `send_command'
    from /home/thufir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/imap.rb:402:in `authenticate'
    from imap.rb:6:in `<main>'
    thufir@dur:~/ruby$



    I'm using dovecot-postfix and dovecot-imapd on Ubuntu 12.04. Thunderbird connects to IMAP on localhost and reads fine with the above configuration (different password, of course).

    The host is dur.bounceme.net of which bounceme.net is owned and operated , and which I've registered that FQDN host name. It doesn't resolve to anything on DNS, it's just to have a FQDN. I'm not sending nor receiving to the internet at large, everything is on localhost, aka dur..bounceme.net, and, of course, to re-iterate, thunderbird just connects to an IMAP server on localhost (dovecot-imapd) and works fine.

    I don't see how it's an Unsupported authentication mechanism. (Net::IMAP::NoResponseError) given that Thunderbird connects fine.



    thanks,

    Thufir
     
    Thufir, Dec 14, 2012
    #1
    1. Advertising

  2. Thufir

    Thufir Guest

    Thufir, Dec 14, 2012
    #2
    1. Advertising

  3. Thufir

    Thufir Guest

    this works:


    require 'net/imap'
    imap = Net::IMAP.new('localhost')
    imap.login('thufir','password')
    puts "logged in"
    imap.select('INBOX')
    mailIds = imap.search(['ALL'])
    mailIds.each do |id|
    msg = imap.fetch(id,'RFC822')[0].attr['RFC822']
    puts msg
    end
    imap.logout()
    imap.disconnect()




    I'll look into the distinction tomorrow. So, of course, in asking the question I found the answer.
     
    Thufir, Dec 14, 2012
    #3
  4. Thufir

    Thufir Guest

    Ok, it's morning and I've looked at the code now. For the record, I adopted the working code from <http://stackoverflow.com/questions/6715256/ruby-net-imap-archive-mail>.

    I'll leave it for later as to why the sample from the NET::IMAP gem invokes a different method (function?). The documentation sample uses imap.authenticate while the sample from stackoverflow uses imap.login for some reason.

    I'm sure that reading the API would explain this, I'll go back to the gem documentation. I don't recall seeing mention of this on the gem web page, but maybe I didn't notice.


    -Thufir
     
    Thufir, Dec 14, 2012
    #4
  5. Thufir

    Guest

    On Friday, December 14, 2012 3:55:12 AM UTC-8, Thufir wrote:
    > How do you login to localhost imap?
    >
    >
    >
    > code:
    >
    >
    >
    > require 'rubygems'
    >
    > require 'net/imap'
    >
    >
    >
    >
    >
    > imap = Net::IMAP.new('localhost')
    >
    > imap.authenticate('LOGIN', 'thufir', 'password')
    >
    > imap.examine('INBOX')
    >
    > imap.search(["RECENT"]).each do |message_id|
    >
    > envelope = imap.fetch(message_id, "ENVELOPE")[0].attr["ENVELOPE"]
    >
    > puts "#{envelope.from[0].name}: \t#{envelope.subject}"
    >
    > end
    >
    >
    >
    >
    >
    > running the code:
    >
    >
    >
    > thufir@dur:~/ruby$
    >
    > thufir@dur:~/ruby$ ruby imap.rb
    >
    > /home/thufir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/imap.rb:1141:in `get_tagged_response': Unsupported authentication mechanism. (Net::IMAP::NoResponseError)
    >
    > from /home/thufir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/imap.rb:1195:in `block in send_command'
    >
    > from /home/thufir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
    >
    > from /home/thufir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/imap.rb:1177:in `send_command'
    >
    > from /home/thufir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/imap.rb:402:in `authenticate'
    >
    > from imap.rb:6:in `<main>'
    >
    > thufir@dur:~/ruby$
    >
    >
    >
    >
    >
    >
    >
    > I'm using dovecot-postfix and dovecot-imapd on Ubuntu 12.04. Thunderbirdconnects to IMAP on localhost and reads fine with the above configuration (different password, of course).
    >
    >
    >
    > The host is dur.bounceme.net of which bounceme.net is owned and operated by , and which I've registered that FQDN host name. It doesn't resolve to anything on DNS, it's just to have a FQDN. I'm not sending nor receiving to the internet at large, everything is on localhost, aka dur.bounceme.net, and, of course, to re-iterate, thunderbird just connects to an IMAP server on localhost (dovecot-imapd) and works fine.
    >
    >
    >
    > I don't see how it's an Unsupported authentication mechanism. (Net::IMAP::NoResponseError) given that Thunderbird connects fine.
    >
    >
    >
    >
    >
    >
    >
    > thanks,
    >
    >
    >
    > Thufir
     
    , Apr 16, 2014
    #5
  6. Thufir

    Guest

    On Friday, December 14, 2012 3:55:12 AM UTC-8, Thufir wrote:
    > How do you login to localhost imap?
    >
    >
    >
    > code:
    >
    >
    >
    > require 'rubygems'
    >
    > require 'net/imap'
    >
    >
    >
    >
    >
    > imap = Net::IMAP.new('localhost')
    >
    > imap.authenticate('LOGIN', 'thufir', 'password')
    >
    > imap.examine('INBOX')
    >
    > imap.search(["RECENT"]).each do |message_id|
    >
    > envelope = imap.fetch(message_id, "ENVELOPE")[0].attr["ENVELOPE"]
    >
    > puts "#{envelope.from[0].name}: \t#{envelope.subject}"
    >
    > end
    >
    >
    >
    >
    >
    > running the code:
    >
    >
    >
    > thufir@dur:~/ruby$
    >
    > thufir@dur:~/ruby$ ruby imap.rb
    >
    > /home/thufir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/imap.rb:1141:in `get_tagged_response': Unsupported authentication mechanism. (Net::IMAP::NoResponseError)
    >
    > from /home/thufir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/imap.rb:1195:in `block in send_command'
    >
    > from /home/thufir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
    >
    > from /home/thufir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/imap.rb:1177:in `send_command'
    >
    > from /home/thufir/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/net/imap.rb:402:in `authenticate'
    >
    > from imap.rb:6:in `<main>'
    >
    > thufir@dur:~/ruby$
    >
    >
    >
    >
    >
    >
    >
    > I'm using dovecot-postfix and dovecot-imapd on Ubuntu 12.04. Thunderbirdconnects to IMAP on localhost and reads fine with the above configuration (different password, of course).
    >
    >
    >
    > The host is dur.bounceme.net of which bounceme.net is owned and operated by , and which I've registered that FQDN host name. It doesn't resolve to anything on DNS, it's just to have a FQDN. I'm not sending nor receiving to the internet at large, everything is on localhost, aka dur.bounceme.net, and, of course, to re-iterate, thunderbird just connects to an IMAP server on localhost (dovecot-imapd) and works fine.
    >
    >
    >
    > I don't see how it's an Unsupported authentication mechanism. (Net::IMAP::NoResponseError) given that Thunderbird connects fine.
    >
    >
    >please remove this feature from my pc
    >
    >
    >
    >
    > thanks,
    >
    >
    >
    > Thufir
     
    , Apr 16, 2014
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Henrik Ormåsen

    Curier-IMAP and imap.create()

    Henrik Ormåsen, Aug 19, 2006, in forum: Ruby
    Replies:
    0
    Views:
    188
    Henrik Ormåsen
    Aug 19, 2006
  2. Jon Fi
    Replies:
    4
    Views:
    589
    Kashia Buch
    Oct 21, 2006
  3. jasonnaylor
    Replies:
    1
    Views:
    267
    jasonnaylor
    Apr 16, 2008
  4. Adam Akhtar
    Replies:
    1
    Views:
    201
    Eric Hodel
    Dec 15, 2008
  5. Abhishiv Saxena

    Support for IMAP IDLE in net/imap

    Abhishiv Saxena, Jul 3, 2009, in forum: Ruby
    Replies:
    4
    Views:
    224
    Eric Hodel
    Jul 4, 2009
Loading...

Share This Page