Getting emails with IMAP generates BadResponseError

Hi,

I have a problem with getting emails from a special account when I will
try to get the emails via IMAP (no SSL).
Here is an example code:

imap = Net::IMAP.new(‘imaphost’)
imap.login(‘user’, ‘pw’)
imap.examine(‘INBOX’)
imap.search(“ALL”).each do |message_id|

end
imap.logout
imap.disconnect

This works fine with other accounts!
The error occurred in line with imap.search:

/usr/local/lib/ruby/1.8/net/imap.rb:972:in `get_tagged_response’:
Protocol error: command unknown or arguments invalid
(Net::IMAP::BadResponseError)

My Ruby version is: 1.8.2 (2004-12-25) [i686-linux]

A “puts imap.capability” on a “good” account shows me:
IMAP4
IMAP4REV1
IDLE
AUTH=LOGIN
AUTH=CRAM-MD5
UNSELECT
LITERAL+

For the account with the error I get only:
IMAP4REV1

I don’t know if this could help, I am not an expert in IMAP.
I hope someone can help.

Thanks.

On Wed, 1 Nov 2006 [email protected] wrote:

For the account with the error I get only:
IMAP4REV1

this is bascially telling you the server does nothing for this accnt…
which
seems odd.

try adding this to the beginning of your script

Net::IMAP::debug = true

and seeing if it gives you more information.

ps. http://www.ietf.org/rfc/rfc2060.txt

-a

I try it and get following output:

S: * OK IMAP4rev1 DvISE Mail Access Server MA-8.10a (0126)
C: RUBY0001 LOGIN xxx xxx
S: RUBY0001 OK LOGIN completed
C: RUBY0002 CAPABILITY
S: * CAPABILITY IMAP4rev1
S: RUBY0002 OK CAPABILITY completed
IMAP4REV1
C: RUBY0003 EXAMINE InBOX
S: * 795 EXISTS
S: * 64 Recent
S: * FLAGS (\Deleted \Seen)
S: * OK [UIDVALIDITY 1154014055] UIDs valid
S: RUBY0003 OK [READ-WRITE] SELECT completed
C: RUBY0004 SEARCH ALL
S: RUBY0004 BAD Protocol error: command unknown or arguments invalid
/usr/local/lib/ruby/1.8/net/imap.rb:972:in `get_tagged_response’:
Protocol error: command unknown or arguments invalid
(Net::IMAP::BadResponseError)

There are 795 mails, this looks good, but I have no idea what is wrong?

[email protected] schrieb: