# Net::IMAP problem

**URL:** <https://www.ruby-forum.com/t/net-imap-problem/183311>\
**Category:** Rails\
**Created:** [February 11, 2010, 3:30pm UTC](https://www.ruby-forum.com/t/net-imap-problem/183311 "2010-02-11T15:30:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [February 11, 2010, 3:30pm UTC](https://www.ruby-forum.com/t/net-imap-problem/183311/1 "2010-02-11T15:30:00Z")

</div>

Hello all,

My Ruby script:

require “net/imap”  
imap = Net::IMAP.new(‘my server’)  
imap.authenticate(‘LOGIN’,‘myuser’,‘mypassword’)

On the 3rd line I get a “NO response” exception raised (indicating that  
the IMAP server replied “NO”) and the error message  
“Net::IMAP::NoResponseError: Unsupported authentication mechanism” If I  
change ‘LOGIN’ to ‘CRAM-MD5’ (the other value supported by Net::IMAP)  
then I get a similar (but not identical) error:  
“Net::IMAP::NoResponseError: Authentication failed: Unsupported  
authentication mechanism” If I use anything other than either ‘LOGIN’ or  
‘CRAM-MD5’ I get an error from the Net::IMAP library saying “Unknown  
auth type” - which is reasonable.

So can you people tell me that what should i do to get rid of this…

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [February 11, 2010, 6:50pm UTC](https://www.ruby-forum.com/t/net-imap-problem/183311/2 "2010-02-11T18:50:22Z")

</div>

Hemant B. wrote:

> Hello all,
> 
> My Ruby script:
> 
> require “net/imap”  
> imap = Net::IMAP.new(‘my server’)  
> imap.authenticate(‘LOGIN’,‘myuser’,‘mypassword’)
> 
> On the 3rd line I get a “NO response” exception raised (indicating that  
> the IMAP server replied “NO”) and the error message  
> “Net::IMAP::NoResponseError: Unsupported authentication mechanism” If I  
> change ‘LOGIN’ to ‘CRAM-MD5’ (the other value supported by Net::IMAP)  
> then I get a similar (but not identical) error:  
> “Net::IMAP::NoResponseError: Authentication failed: Unsupported  
> authentication mechanism” If I use anything other than either ‘LOGIN’ or  
> ‘CRAM-MD5’ I get an error from the Net::IMAP library saying “Unknown  
> auth type” - which is reasonable.
> 
> So can you people tell me that what should i do to get rid of this…

You may want to ask this on the Ruby list…

But since you’re trying LOGIN authentication, have you tried using the  
Net::IMAP#login method? Also, what does imap.capability say?
