Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   flagging multiple messages in one command with imaplib? (http://www.velocityreviews.com/forums/t321934-flagging-multiple-messages-in-one-command-with-imaplib.html)

Mr. Magoo 09-01-2003 08:43 PM

flagging multiple messages in one command with imaplib?
 
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]
sys.exit(1)

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

typ, data = imapcon.select('INBOX')
check_error(typ, data)

typ, data = imapcon.search(None, 'NOT', 'FLAGGED', 'SINCE',
'28-AUG-2003')
check_error(typ, data)

print data[0]

typ, data = imapcon.store(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.)

Thanks.
M.


All times are GMT. The time now is 04:57 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.