473,396 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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.
Jul 18 '05 #1
0 1464

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Colin Brown | last post by:
The Python 2.3 documentation in imaplib says: Internaldate2tuple( datestr) Converts an IMAP4 INTERNALDATE string to Coordinated Universal Time. Returns a time module tuple. Time2Internaldate(...
1
by: Raghul | last post by:
Is it posssible to read only the new messages or unread messages using imaplib in python? If it is possible pls specify the module or give a sample code. Thanks in advance
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
0
by: BL | last post by:
Hi all, I've got a number of sub-folders in my Outlook Express Inbox. I've also set up a number of message rules to make sure that email from particular individuals/organisations are moved to...
2
by: huw.lynes | last post by:
So I have the unfortunate task of migrating several hundred users from local mail (mbox and mh) up to an exchange server as part of wearisome SOX compliance nonsense. I thought the best path...
1
by: Chris Curvey | last post by:
Hi all, I've apparently tied myself up a bit using the logging package. In my project, I have a core set of model and controller classes that set up their logging using logging.fileConfig()....
5
by: Antoon Pardon | last post by:
This little program gives IMO a strange result. import imaplib user = "cpapen" cyr = imaplib.IMAP4("imap.vub.ac.be") cyr.login("cyrus", "cOn-A1r") rc, lst = cyr.list('""', "user/%s/*" %...
1
by: aspineux | last post by:
imaplib use exception to report errors, but some problems must be detected by checking the return value ! For example, when trying to append into a mailbox with wrong ACL, imaplib return 'NO',...
0
by: aspineux | last post by:
setacl and getacl look to be already "Cyrus" specific (according the doc), why not to extend imaplib a little bit more ? Here are some code I wrote and tested to support cyrus "expire" that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.