Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > flagging multiple messages in one command with imaplib?

Thread Tools

flagging multiple messages in one command with imaplib?

Mr. Magoo
Posts: n/a
I'm working with imaplib. I'm trying to flag (or move or copy - anything
that takes a message_set as an argument) a bunch of messages with one
command and am having trouble.


def check_error(typ, data):
if (typ != 'OK'):
print typ
print data[0]

imapcon = imaplib.IMAP4(HOST)
imapcon.login_cram_md5(USER, PASS)

typ, data ='INBOX')
check_error(typ, data)

typ, data =, 'NOT', 'FLAGGED', 'SINCE',
check_error(typ, data)

print data[0]

typ, data =[0], "+FLAGS.SILENT", r'(\FLAGGED)')
print typ
print data
check_error(typ, data)


When my mail client does this it sends the message numbers unquoted, but
imaplib seems to quote them, leading to

imaplib.error: STORE command error: BAD ['Bogus attribute list in STORE']

What am I doing wrong? How do I work with multiple messages in one
command. (The primary consideration here is speed - 1 command is much
faster than N when N is large.)

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flagging Junk mail Stubby Firefox 1 03-21-2006 08:11 AM
Flagging packets as low priority Cisco 0 11-03-2005 04:00 PM
exam 316 win apps, measure-up test software, confidence flagging. Peter Row MCSD 4 09-08-2005 12:16 PM
New Panasonic DVD Player: Memory Flagging Of A Position For Future Recall - How ? Robert11 DVD Video 0 06-23-2004 06:19 PM
Best Practice: Flagging Changed Rows Mario T. Lanza ASP General 1 02-16-2004 10:17 PM