By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,908 Members | 1,850 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,908 IT Pros & Developers. It's quick & easy.

IMAP SEARCH Error

P: n/a
I am using the imaplib to fetch mails. There is an error thrown in the
search function, which I am not able to comprehend.

My program is as follows :
====================
import imaplib

M = imaplib.IMAP4("10.1.1.1",1143)
M.login("roopesh", "roopesh12")
type, data = M.select("INBOX", 1)

print type, data
print M.status("INBOX", '(MESSAGES UNSEEN RECENT)')

typ, data = M.search(None, '(ALL)')

print typ, data
for num in data[0].split():
typ, data = M.fetch(num, '(RFC822)')
print 'Message %s\n%s\n' % (num, data[0][1])
M.close()
M.logout()

And the OUTPUT in the console is as follows :
==================================

OK ['24']
('OK', ['INBOX ( MESSAGES 24 UNSEEN 0 RECENT 0)'])
Traceback (most recent call last):
File "imap_test1.py", line 10, in ?
typ, data = M.search(None, '(ALL)')
File "c:\python24\lib\imaplib.py", line 602, in search
typ, dat = self._simple_command(name, *criteria)
File "c:\python24\lib\imaplib.py", line 1028, in _simple_command
return self._command_complete(name, self._command(name, *args))
File "c:\python24\lib\imaplib.py", line 860, in _command_complete
raise self.abort('command: %s =%s' % (name, val))
imaplib.abort: command: SEARCH =unexpected response: '*'

Can anyone tell me why this happens ?

Regards
Roopesh

Jan 17 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
imaplib.abort: command: SEARCH =unexpected response: '*'
>
Can anyone tell me why this happens ?
It looks like a server problem. What kind of server are you using ?
Exchange, Cyrus ?
Did you try with two different Imap servers ?
If it is a unix server, did you have a look in /var/log ? Or in windows
event log ?
Jan 17 '07 #2

P: n/a
Roopesh wrote:
I am using the imaplib to fetch mails. There is an error thrown in the
search function, which I am not able to comprehend.
I had difficulties with the imaplib, too. It is very low level. You need
to know some parts of the IMAP protocol.

I solved my problems by checking with ethereal (wireshark) what
other applications (KMail, getmail) do.

getmail is like fetchmail, but written in Python. I found some hints
by looking at its source.

HTH,
Thomas

--
Thomas GŁttler, http://www.thomas-guettler.de/ http://www.tbz-pariv.de/
E-Mail: guettli (*) thomas-guettler + de
Spam Catcher: ni**************@thomas-guettler.de

Jan 17 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.